From c9f2b8592b2e9ba9cdba11691c7e878df2d53e6a Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 10:20:59 +0100 Subject: [PATCH 01/23] Made Kernel.java as interface, extracted class into BaseKernel.java --- .../de/dmi3y/behaiv/kernel/BaseKernel.java | 100 ++++++++++++++++++ .../java/de/dmi3y/behaiv/kernel/Kernel.java | 88 +++------------ .../kernel/LogisticRegressionKernel.java | 2 +- src/test/java/de/dmi3y/behaiv/BehaivTest.java | 5 +- 4 files changed, 119 insertions(+), 76 deletions(-) create mode 100644 src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java diff --git a/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java b/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java new file mode 100644 index 0000000..04ef86b --- /dev/null +++ b/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java @@ -0,0 +1,100 @@ +package de.dmi3y.behaiv.kernel; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import de.dmi3y.behaiv.storage.BehaivStorage; +import de.dmi3y.behaiv.tools.Pair; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public abstract class BaseKernel implements Kernel { + + protected String id; + protected Long treshold = 10L; + protected ObjectMapper objectMapper; + protected boolean partialFitAllowed = false; + protected boolean alwaysKeepData = true; + + public BaseKernel(String id) { + this.id = id; + objectMapper = new ObjectMapper(); + } + + + @Override + public void setId(String id) { + this.id = id; + } + + + //list, label + protected List, String>> data = new ArrayList<>(); + + + @Override + public void fit() { + fit(this.data); + } + + @Override + public void setTreshold(Long treshold) { + this.treshold = treshold; + } + + @Override + public boolean readyToPredict() { + return data.size() > treshold; + } + + @Override + public void update(List, String>> data) { + } + + @Override + public boolean isPartialFitAllowed() { + return partialFitAllowed; + } + + @Override + public void updateSingle(List features, String label) { + data.add(new Pair<>(features, label)); + } + + @Override + public boolean isAlwaysKeepData() { + return alwaysKeepData; + } + + @Override + public void setAlwaysKeepData(boolean alwaysKeepData) { + this.alwaysKeepData = alwaysKeepData; + } + + @Override + public void save(BehaivStorage storage) throws IOException { + + try (final BufferedWriter writer = new BufferedWriter(new FileWriter(storage.getDataFile(id)))) { + writer.write(objectMapper.writeValueAsString(data)); + } + } + + @Override + public void restore(BehaivStorage storage) throws IOException { + final TypeReference, String>>> typeReference = new TypeReference, String>>>() { + }; + try (final BufferedReader reader = new BufferedReader(new FileReader(storage.getDataFile(id)))) { + final String content = reader.readLine(); + if (content == null || content.isEmpty()) { + data = new ArrayList<>(); + } else { + data = objectMapper.readValue(content, typeReference); + } + } + } +} diff --git a/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java b/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java index ec414f5..b2db896 100644 --- a/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java +++ b/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java @@ -1,95 +1,37 @@ package de.dmi3y.behaiv.kernel; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; import de.dmi3y.behaiv.storage.BehaivStorage; import de.dmi3y.behaiv.tools.Pair; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.FileReader; -import java.io.FileWriter; import java.io.IOException; -import java.util.ArrayList; import java.util.List; -public abstract class Kernel { +public interface Kernel { + void setId(String id); - protected String id; - protected Long treshold = 10L; - protected ObjectMapper objectMapper; - protected boolean partialFitAllowed = false; - protected boolean alwaysKeepData = true; + boolean isEmpty(); - public Kernel(String id) { - this.id = id; - objectMapper = new ObjectMapper(); - } + void fit(List, String>> data); + void fit(); - public void setId(String id) { - this.id = id; - } + void setTreshold(Long treshold); + boolean readyToPredict(); - //list, label - protected List, String>> data = new ArrayList<>(); + void update(List, String>> data); + boolean isPartialFitAllowed(); - public abstract boolean isEmpty(); + void updateSingle(List features, String label); - public abstract void fit(List, String>> data); + String predictOne(List features); - public void fit() { - fit(this.data); - } + boolean isAlwaysKeepData(); - public void setTreshold(Long treshold) { - this.treshold = treshold; - } + void setAlwaysKeepData(boolean alwaysKeepData); - public boolean readyToPredict() { - return data.size() > treshold; - } + void save(BehaivStorage storage) throws IOException; - public void update(List, String>> data) { - } - - public boolean isPartialFitAllowed() { - return partialFitAllowed; - } - - public void updateSingle(List features, String label) { - data.add(new Pair<>(features, label)); - } - - public abstract String predictOne(List features); - - public boolean isAlwaysKeepData() { - return alwaysKeepData; - } - - public void setAlwaysKeepData(boolean alwaysKeepData) { - this.alwaysKeepData = alwaysKeepData; - } - - public void save(BehaivStorage storage) throws IOException { - - try (final BufferedWriter writer = new BufferedWriter(new FileWriter(storage.getDataFile(id)))) { - writer.write(objectMapper.writeValueAsString(data)); - } - } - - public void restore(BehaivStorage storage) throws IOException { - final TypeReference, String>>> typeReference = new TypeReference, String>>>() { - }; - try (final BufferedReader reader = new BufferedReader(new FileReader(storage.getDataFile(id)))) { - final String content = reader.readLine(); - if (content == null || content.isEmpty()) { - data = new ArrayList<>(); - } else { - data = objectMapper.readValue(content, typeReference); - } - } - } + void restore(BehaivStorage storage) throws IOException; } diff --git a/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java b/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java index 5205d25..3337192 100644 --- a/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java +++ b/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java @@ -17,7 +17,7 @@ import static de.dmi3y.behaiv.tools.DataMappingUtils.toDistinctListOfPairValues; import static de.dmi3y.behaiv.tools.DataMappingUtils.toInput2dArray; -public class LogisticRegressionKernel extends Kernel { +public class LogisticRegressionKernel extends BaseKernel { protected List labels = new ArrayList<>(); private Random rand; diff --git a/src/test/java/de/dmi3y/behaiv/BehaivTest.java b/src/test/java/de/dmi3y/behaiv/BehaivTest.java index 9c9091b..354eea4 100644 --- a/src/test/java/de/dmi3y/behaiv/BehaivTest.java +++ b/src/test/java/de/dmi3y/behaiv/BehaivTest.java @@ -1,5 +1,6 @@ package de.dmi3y.behaiv; +import de.dmi3y.behaiv.kernel.BaseKernel; import de.dmi3y.behaiv.kernel.Kernel; import de.dmi3y.behaiv.kernel.LogisticRegressionKernel; import de.dmi3y.behaiv.provider.DayTimeProvider; @@ -59,7 +60,7 @@ public void stopCapturing_whenDiscard_sessionShouldBeNull() { @Test public void startCapturing_tryToRestore_restoreNetwork() throws IOException { - final Kernel mockKernel = mock(Kernel.class); + final Kernel mockKernel = mock(BaseKernel.class); final BehaivStorage storage = mock(BehaivStorage.class); final Behaiv behaiv = new Behaiv.Builder("testId") .setKernel(mockKernel) @@ -75,7 +76,7 @@ public void startCapturing_tryToRestore_restoreNetwork() throws IOException { @Test public void startCapturing_withIOException_continueWithoutSaving() throws IOException { - final Kernel testKernel = mock(Kernel.class); + final Kernel testKernel = mock(BaseKernel.class); final BehaivStorage storage = mock(BehaivStorage.class); final Behaiv behaiv = Behaiv.with("testId") .setKernel(testKernel) From 5c4cf4d1045d50063736aa9b88d9c87c0f9ce8a3 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 10:45:39 +0100 Subject: [PATCH 02/23] Added generated proto files --- .../java/tech/donau/behaiv/proto/Action.java | 1379 +++++++++++++++++ .../donau/behaiv/proto/ActionOrBuilder.java | 114 ++ .../java/tech/donau/behaiv/proto/Behaiv.java | 112 ++ .../java/tech/donau/behaiv/proto/Data.java | 627 ++++++++ .../donau/behaiv/proto/DataOrBuilder.java | 27 + .../tech/donau/behaiv/proto/Prediction.java | 901 +++++++++++ .../behaiv/proto/PredictionOrBuilder.java | 45 + .../donau/behaiv/proto/PredictionSet.java | 765 +++++++++ .../behaiv/proto/PredictionSetOrBuilder.java | 33 + .../java/tech/donau/behaiv/proto/Screen.java | 617 ++++++++ .../donau/behaiv/proto/ScreenOrBuilder.java | 27 + 11 files changed, 4647 insertions(+) create mode 100644 src/main/java/tech/donau/behaiv/proto/Action.java create mode 100644 src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java create mode 100644 src/main/java/tech/donau/behaiv/proto/Behaiv.java create mode 100644 src/main/java/tech/donau/behaiv/proto/Data.java create mode 100644 src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java create mode 100644 src/main/java/tech/donau/behaiv/proto/Prediction.java create mode 100644 src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java create mode 100644 src/main/java/tech/donau/behaiv/proto/PredictionSet.java create mode 100644 src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java create mode 100644 src/main/java/tech/donau/behaiv/proto/Screen.java create mode 100644 src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java diff --git a/src/main/java/tech/donau/behaiv/proto/Action.java b/src/main/java/tech/donau/behaiv/proto/Action.java new file mode 100644 index 0000000..942d4f8 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/Action.java @@ -0,0 +1,1379 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +/** + *
+ * Communication messages
+ * 
+ * + * Protobuf type {@code Action} + */ +public final class Action extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Action) + ActionOrBuilder { +private static final long serialVersionUID = 0L; + // Use Action.newBuilder() to construct. + private Action(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Action() { + action_ = ""; + object_ = ""; + screenStack_ = emptyIntList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Action(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Action( + 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; + case 8: { + + localId_ = input.readInt64(); + break; + } + case 16: { + + prevLocalId_ = input.readInt64(); + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + action_ = s; + break; + } + case 34: { + java.lang.String s = input.readStringRequireUtf8(); + + object_ = s; + break; + } + case 40: { + + currentScreenId_ = input.readInt32(); + break; + } + case 48: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + screenStack_ = newIntList(); + mutable_bitField0_ |= 0x00000001; + } + screenStack_.addInt(input.readInt32()); + break; + } + case 50: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) { + screenStack_ = newIntList(); + mutable_bitField0_ |= 0x00000001; + } + while (input.getBytesUntilLimit() > 0) { + screenStack_.addInt(input.readInt32()); + } + input.popLimit(limit); + break; + } + case 66: { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + attributes_ = com.google.protobuf.MapField.newMapField( + AttributesDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000002; + } + com.google.protobuf.MapEntry + attributes__ = input.readMessage( + AttributesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + attributes_.getMutableMap().put( + attributes__.getKey(), attributes__.getValue()); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + 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) != 0)) { + screenStack_.makeImmutable(); // C + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Action_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 8: + return internalGetAttributes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Action_fieldAccessorTable + .ensureFieldAccessorsInitialized( + tech.donau.behaiv.proto.Action.class, tech.donau.behaiv.proto.Action.Builder.class); + } + + public static final int LOCAL_ID_FIELD_NUMBER = 1; + private long localId_; + /** + * int64 local_id = 1; + * @return The localId. + */ + public long getLocalId() { + return localId_; + } + + public static final int PREV_LOCAL_ID_FIELD_NUMBER = 2; + private long prevLocalId_; + /** + * int64 prev_local_id = 2; + * @return The prevLocalId. + */ + public long getPrevLocalId() { + return prevLocalId_; + } + + public static final int ACTION_FIELD_NUMBER = 3; + private volatile java.lang.Object action_; + /** + * string action = 3; + * @return The action. + */ + public java.lang.String getAction() { + java.lang.Object ref = action_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + action_ = s; + return s; + } + } + /** + * string action = 3; + * @return The bytes for action. + */ + public com.google.protobuf.ByteString + getActionBytes() { + java.lang.Object ref = action_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + action_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int OBJECT_FIELD_NUMBER = 4; + private volatile java.lang.Object object_; + /** + * string object = 4; + * @return The object. + */ + public java.lang.String getObject() { + java.lang.Object ref = object_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + object_ = s; + return s; + } + } + /** + * string object = 4; + * @return The bytes for object. + */ + public com.google.protobuf.ByteString + getObjectBytes() { + java.lang.Object ref = object_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + object_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CURRENT_SCREEN_ID_FIELD_NUMBER = 5; + private int currentScreenId_; + /** + * int32 current_screen_id = 5; + * @return The currentScreenId. + */ + public int getCurrentScreenId() { + return currentScreenId_; + } + + public static final int SCREEN_STACK_FIELD_NUMBER = 6; + private com.google.protobuf.Internal.IntList screenStack_; + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @return A list containing the screenStack. + */ + public java.util.List + getScreenStackList() { + return screenStack_; + } + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @return The count of screenStack. + */ + public int getScreenStackCount() { + return screenStack_.size(); + } + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @param index The index of the element to return. + * @return The screenStack at the given index. + */ + public int getScreenStack(int index) { + return screenStack_.getInt(index); + } + private int screenStackMemoizedSerializedSize = -1; + + public static final int ATTRIBUTES_FIELD_NUMBER = 8; + private static final class AttributesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + tech.donau.behaiv.proto.Behaiv.internal_static_Action_AttributesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> attributes_; + private com.google.protobuf.MapField + internalGetAttributes() { + if (attributes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AttributesDefaultEntryHolder.defaultEntry); + } + return attributes_; + } + + public int getAttributesCount() { + return internalGetAttributes().getMap().size(); + } + /** + * map<string, string> attributes = 8; + */ + + public boolean containsAttributes( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + return internalGetAttributes().getMap().containsKey(key); + } + /** + * Use {@link #getAttributesMap()} instead. + */ + @java.lang.Deprecated + public java.util.Map getAttributes() { + return getAttributesMap(); + } + /** + * map<string, string> attributes = 8; + */ + + public java.util.Map getAttributesMap() { + return internalGetAttributes().getMap(); + } + /** + * map<string, string> attributes = 8; + */ + + public java.lang.String getAttributesOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetAttributes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, string> attributes = 8; + */ + + public java.lang.String getAttributesOrThrow( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetAttributes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (localId_ != 0L) { + output.writeInt64(1, localId_); + } + if (prevLocalId_ != 0L) { + output.writeInt64(2, prevLocalId_); + } + if (!getActionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, action_); + } + if (!getObjectBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, object_); + } + if (currentScreenId_ != 0) { + output.writeInt32(5, currentScreenId_); + } + if (getScreenStackList().size() > 0) { + output.writeUInt32NoTag(50); + output.writeUInt32NoTag(screenStackMemoizedSerializedSize); + } + for (int i = 0; i < screenStack_.size(); i++) { + output.writeInt32NoTag(screenStack_.getInt(i)); + } + com.google.protobuf.GeneratedMessageV3 + .serializeStringMapTo( + output, + internalGetAttributes(), + AttributesDefaultEntryHolder.defaultEntry, + 8); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (localId_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, localId_); + } + if (prevLocalId_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, prevLocalId_); + } + if (!getActionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, action_); + } + if (!getObjectBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, object_); + } + if (currentScreenId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, currentScreenId_); + } + { + int dataSize = 0; + for (int i = 0; i < screenStack_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(screenStack_.getInt(i)); + } + size += dataSize; + if (!getScreenStackList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + screenStackMemoizedSerializedSize = dataSize; + } + for (java.util.Map.Entry entry + : internalGetAttributes().getMap().entrySet()) { + com.google.protobuf.MapEntry + attributes__ = AttributesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, attributes__); + } + 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 tech.donau.behaiv.proto.Action)) { + return super.equals(obj); + } + tech.donau.behaiv.proto.Action other = (tech.donau.behaiv.proto.Action) obj; + + if (getLocalId() + != other.getLocalId()) return false; + if (getPrevLocalId() + != other.getPrevLocalId()) return false; + if (!getAction() + .equals(other.getAction())) return false; + if (!getObject() + .equals(other.getObject())) return false; + if (getCurrentScreenId() + != other.getCurrentScreenId()) return false; + if (!getScreenStackList() + .equals(other.getScreenStackList())) return false; + if (!internalGetAttributes().equals( + other.internalGetAttributes())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + LOCAL_ID_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getLocalId()); + hash = (37 * hash) + PREV_LOCAL_ID_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getPrevLocalId()); + hash = (37 * hash) + ACTION_FIELD_NUMBER; + hash = (53 * hash) + getAction().hashCode(); + hash = (37 * hash) + OBJECT_FIELD_NUMBER; + hash = (53 * hash) + getObject().hashCode(); + hash = (37 * hash) + CURRENT_SCREEN_ID_FIELD_NUMBER; + hash = (53 * hash) + getCurrentScreenId(); + if (getScreenStackCount() > 0) { + hash = (37 * hash) + SCREEN_STACK_FIELD_NUMBER; + hash = (53 * hash) + getScreenStackList().hashCode(); + } + if (!internalGetAttributes().getMap().isEmpty()) { + hash = (37 * hash) + ATTRIBUTES_FIELD_NUMBER; + hash = (53 * hash) + internalGetAttributes().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static tech.donau.behaiv.proto.Action parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Action parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Action parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Action parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Action parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Action parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Action parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Action 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 tech.donau.behaiv.proto.Action parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Action 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 tech.donau.behaiv.proto.Action parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Action parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(tech.donau.behaiv.proto.Action prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + 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; + } + /** + *
+   * Communication messages
+   * 
+ * + * Protobuf type {@code Action} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:Action) + tech.donau.behaiv.proto.ActionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Action_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 8: + return internalGetAttributes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField( + int number) { + switch (number) { + case 8: + return internalGetMutableAttributes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Action_fieldAccessorTable + .ensureFieldAccessorsInitialized( + tech.donau.behaiv.proto.Action.class, tech.donau.behaiv.proto.Action.Builder.class); + } + + // Construct using tech.donau.behaiv.proto.Action.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + localId_ = 0L; + + prevLocalId_ = 0L; + + action_ = ""; + + object_ = ""; + + currentScreenId_ = 0; + + screenStack_ = emptyIntList(); + bitField0_ = (bitField0_ & ~0x00000001); + internalGetMutableAttributes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Action_descriptor; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Action getDefaultInstanceForType() { + return tech.donau.behaiv.proto.Action.getDefaultInstance(); + } + + @java.lang.Override + public tech.donau.behaiv.proto.Action build() { + tech.donau.behaiv.proto.Action result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Action buildPartial() { + tech.donau.behaiv.proto.Action result = new tech.donau.behaiv.proto.Action(this); + int from_bitField0_ = bitField0_; + result.localId_ = localId_; + result.prevLocalId_ = prevLocalId_; + result.action_ = action_; + result.object_ = object_; + result.currentScreenId_ = currentScreenId_; + if (((bitField0_ & 0x00000001) != 0)) { + screenStack_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.screenStack_ = screenStack_; + result.attributes_ = internalGetAttributes(); + result.attributes_.makeImmutable(); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof tech.donau.behaiv.proto.Action) { + return mergeFrom((tech.donau.behaiv.proto.Action)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(tech.donau.behaiv.proto.Action other) { + if (other == tech.donau.behaiv.proto.Action.getDefaultInstance()) return this; + if (other.getLocalId() != 0L) { + setLocalId(other.getLocalId()); + } + if (other.getPrevLocalId() != 0L) { + setPrevLocalId(other.getPrevLocalId()); + } + if (!other.getAction().isEmpty()) { + action_ = other.action_; + onChanged(); + } + if (!other.getObject().isEmpty()) { + object_ = other.object_; + onChanged(); + } + if (other.getCurrentScreenId() != 0) { + setCurrentScreenId(other.getCurrentScreenId()); + } + if (!other.screenStack_.isEmpty()) { + if (screenStack_.isEmpty()) { + screenStack_ = other.screenStack_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureScreenStackIsMutable(); + screenStack_.addAll(other.screenStack_); + } + onChanged(); + } + internalGetMutableAttributes().mergeFrom( + other.internalGetAttributes()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + tech.donau.behaiv.proto.Action parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (tech.donau.behaiv.proto.Action) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private long localId_ ; + /** + * int64 local_id = 1; + * @return The localId. + */ + public long getLocalId() { + return localId_; + } + /** + * int64 local_id = 1; + * @param value The localId to set. + * @return This builder for chaining. + */ + public Builder setLocalId(long value) { + + localId_ = value; + onChanged(); + return this; + } + /** + * int64 local_id = 1; + * @return This builder for chaining. + */ + public Builder clearLocalId() { + + localId_ = 0L; + onChanged(); + return this; + } + + private long prevLocalId_ ; + /** + * int64 prev_local_id = 2; + * @return The prevLocalId. + */ + public long getPrevLocalId() { + return prevLocalId_; + } + /** + * int64 prev_local_id = 2; + * @param value The prevLocalId to set. + * @return This builder for chaining. + */ + public Builder setPrevLocalId(long value) { + + prevLocalId_ = value; + onChanged(); + return this; + } + /** + * int64 prev_local_id = 2; + * @return This builder for chaining. + */ + public Builder clearPrevLocalId() { + + prevLocalId_ = 0L; + onChanged(); + return this; + } + + private java.lang.Object action_ = ""; + /** + * string action = 3; + * @return The action. + */ + public java.lang.String getAction() { + java.lang.Object ref = action_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + action_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string action = 3; + * @return The bytes for action. + */ + public com.google.protobuf.ByteString + getActionBytes() { + java.lang.Object ref = action_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + action_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string action = 3; + * @param value The action to set. + * @return This builder for chaining. + */ + public Builder setAction( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + action_ = value; + onChanged(); + return this; + } + /** + * string action = 3; + * @return This builder for chaining. + */ + public Builder clearAction() { + + action_ = getDefaultInstance().getAction(); + onChanged(); + return this; + } + /** + * string action = 3; + * @param value The bytes for action to set. + * @return This builder for chaining. + */ + public Builder setActionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + action_ = value; + onChanged(); + return this; + } + + private java.lang.Object object_ = ""; + /** + * string object = 4; + * @return The object. + */ + public java.lang.String getObject() { + java.lang.Object ref = object_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + object_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string object = 4; + * @return The bytes for object. + */ + public com.google.protobuf.ByteString + getObjectBytes() { + java.lang.Object ref = object_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + object_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string object = 4; + * @param value The object to set. + * @return This builder for chaining. + */ + public Builder setObject( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + object_ = value; + onChanged(); + return this; + } + /** + * string object = 4; + * @return This builder for chaining. + */ + public Builder clearObject() { + + object_ = getDefaultInstance().getObject(); + onChanged(); + return this; + } + /** + * string object = 4; + * @param value The bytes for object to set. + * @return This builder for chaining. + */ + public Builder setObjectBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + object_ = value; + onChanged(); + return this; + } + + private int currentScreenId_ ; + /** + * int32 current_screen_id = 5; + * @return The currentScreenId. + */ + public int getCurrentScreenId() { + return currentScreenId_; + } + /** + * int32 current_screen_id = 5; + * @param value The currentScreenId to set. + * @return This builder for chaining. + */ + public Builder setCurrentScreenId(int value) { + + currentScreenId_ = value; + onChanged(); + return this; + } + /** + * int32 current_screen_id = 5; + * @return This builder for chaining. + */ + public Builder clearCurrentScreenId() { + + currentScreenId_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Internal.IntList screenStack_ = emptyIntList(); + private void ensureScreenStackIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + screenStack_ = mutableCopy(screenStack_); + bitField0_ |= 0x00000001; + } + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @return A list containing the screenStack. + */ + public java.util.List + getScreenStackList() { + return ((bitField0_ & 0x00000001) != 0) ? + java.util.Collections.unmodifiableList(screenStack_) : screenStack_; + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @return The count of screenStack. + */ + public int getScreenStackCount() { + return screenStack_.size(); + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @param index The index of the element to return. + * @return The screenStack at the given index. + */ + public int getScreenStack(int index) { + return screenStack_.getInt(index); + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @param index The index to set the value at. + * @param value The screenStack to set. + * @return This builder for chaining. + */ + public Builder setScreenStack( + int index, int value) { + ensureScreenStackIsMutable(); + screenStack_.setInt(index, value); + onChanged(); + return this; + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @param value The screenStack to add. + * @return This builder for chaining. + */ + public Builder addScreenStack(int value) { + ensureScreenStackIsMutable(); + screenStack_.addInt(value); + onChanged(); + return this; + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @param values The screenStack to add. + * @return This builder for chaining. + */ + public Builder addAllScreenStack( + java.lang.Iterable values) { + ensureScreenStackIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, screenStack_); + onChanged(); + return this; + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @return This builder for chaining. + */ + public Builder clearScreenStack() { + screenStack_ = emptyIntList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> attributes_; + private com.google.protobuf.MapField + internalGetAttributes() { + if (attributes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AttributesDefaultEntryHolder.defaultEntry); + } + return attributes_; + } + private com.google.protobuf.MapField + internalGetMutableAttributes() { + onChanged();; + if (attributes_ == null) { + attributes_ = com.google.protobuf.MapField.newMapField( + AttributesDefaultEntryHolder.defaultEntry); + } + if (!attributes_.isMutable()) { + attributes_ = attributes_.copy(); + } + return attributes_; + } + + public int getAttributesCount() { + return internalGetAttributes().getMap().size(); + } + /** + * map<string, string> attributes = 8; + */ + + public boolean containsAttributes( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + return internalGetAttributes().getMap().containsKey(key); + } + /** + * Use {@link #getAttributesMap()} instead. + */ + @java.lang.Deprecated + public java.util.Map getAttributes() { + return getAttributesMap(); + } + /** + * map<string, string> attributes = 8; + */ + + public java.util.Map getAttributesMap() { + return internalGetAttributes().getMap(); + } + /** + * map<string, string> attributes = 8; + */ + + public java.lang.String getAttributesOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetAttributes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, string> attributes = 8; + */ + + public java.lang.String getAttributesOrThrow( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetAttributes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAttributes() { + internalGetMutableAttributes().getMutableMap() + .clear(); + return this; + } + /** + * map<string, string> attributes = 8; + */ + + public Builder removeAttributes( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + internalGetMutableAttributes().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableAttributes() { + return internalGetMutableAttributes().getMutableMap(); + } + /** + * map<string, string> attributes = 8; + */ + public Builder putAttributes( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new java.lang.NullPointerException(); } + if (value == null) { throw new java.lang.NullPointerException(); } + internalGetMutableAttributes().getMutableMap() + .put(key, value); + return this; + } + /** + * map<string, string> attributes = 8; + */ + + public Builder putAllAttributes( + java.util.Map values) { + internalGetMutableAttributes().getMutableMap() + .putAll(values); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:Action) + } + + // @@protoc_insertion_point(class_scope:Action) + private static final tech.donau.behaiv.proto.Action DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new tech.donau.behaiv.proto.Action(); + } + + public static tech.donau.behaiv.proto.Action getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Action parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Action(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Action getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java new file mode 100644 index 0000000..dfc71cf --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java @@ -0,0 +1,114 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public interface ActionOrBuilder extends + // @@protoc_insertion_point(interface_extends:Action) + com.google.protobuf.MessageOrBuilder { + + /** + * int64 local_id = 1; + * @return The localId. + */ + long getLocalId(); + + /** + * int64 prev_local_id = 2; + * @return The prevLocalId. + */ + long getPrevLocalId(); + + /** + * string action = 3; + * @return The action. + */ + java.lang.String getAction(); + /** + * string action = 3; + * @return The bytes for action. + */ + com.google.protobuf.ByteString + getActionBytes(); + + /** + * string object = 4; + * @return The object. + */ + java.lang.String getObject(); + /** + * string object = 4; + * @return The bytes for object. + */ + com.google.protobuf.ByteString + getObjectBytes(); + + /** + * int32 current_screen_id = 5; + * @return The currentScreenId. + */ + int getCurrentScreenId(); + + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @return A list containing the screenStack. + */ + java.util.List getScreenStackList(); + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @return The count of screenStack. + */ + int getScreenStackCount(); + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @param index The index of the element to return. + * @return The screenStack at the given index. + */ + int getScreenStack(int index); + + /** + * map<string, string> attributes = 8; + */ + int getAttributesCount(); + /** + * map<string, string> attributes = 8; + */ + boolean containsAttributes( + java.lang.String key); + /** + * Use {@link #getAttributesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getAttributes(); + /** + * map<string, string> attributes = 8; + */ + java.util.Map + getAttributesMap(); + /** + * map<string, string> attributes = 8; + */ + + java.lang.String getAttributesOrDefault( + java.lang.String key, + java.lang.String defaultValue); + /** + * map<string, string> attributes = 8; + */ + + java.lang.String getAttributesOrThrow( + java.lang.String key); +} diff --git a/src/main/java/tech/donau/behaiv/proto/Behaiv.java b/src/main/java/tech/donau/behaiv/proto/Behaiv.java new file mode 100644 index 0000000..7c5bde9 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/Behaiv.java @@ -0,0 +1,112 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public final class Behaiv { + private Behaiv() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + static final com.google.protobuf.Descriptors.Descriptor + internal_static_Data_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Data_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_Prediction_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Prediction_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_PredictionSet_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_PredictionSet_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_Action_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Action_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_Action_AttributesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Action_AttributesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_Screen_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Screen_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\014behaiv.proto\"(\n\004Data\022\013\n\003key\030\002 \001(\t\022\r\n\005v" + + "alue\030\003 \001(\001J\004\010\001\020\002\"5\n\nPrediction\022\023\n\004data\030\001" + + " \003(\0132\005.Data\022\022\n\nprediction\030\002 \001(\t\"0\n\rPredi" + + "ctionSet\022\037\n\nprediction\030\001 \003(\0132\013.Predictio" + + "n\"\342\001\n\006Action\022\020\n\010local_id\030\001 \001(\003\022\025\n\rprev_l" + + "ocal_id\030\002 \001(\003\022\016\n\006action\030\003 \001(\t\022\016\n\006object\030" + + "\004 \001(\t\022\031\n\021current_screen_id\030\005 \001(\005\022\024\n\014scre" + + "en_stack\030\006 \003(\005\022+\n\nattributes\030\010 \003(\0132\027.Act" + + "ion.AttributesEntry\0321\n\017AttributesEntry\022\013" + + "\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\"\n\006Screen" + + "\022\n\n\002id\030\001 \001(\005\022\014\n\004name\030\002 \001(\tB\033\n\027tech.donau" + + ".behaiv.protoP\001b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_Data_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_Data_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Data_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_Prediction_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_Prediction_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Prediction_descriptor, + new java.lang.String[] { "Data", "Prediction", }); + internal_static_PredictionSet_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_PredictionSet_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_PredictionSet_descriptor, + new java.lang.String[] { "Prediction", }); + internal_static_Action_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_Action_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Action_descriptor, + new java.lang.String[] { "LocalId", "PrevLocalId", "Action", "Object", "CurrentScreenId", "ScreenStack", "Attributes", }); + internal_static_Action_AttributesEntry_descriptor = + internal_static_Action_descriptor.getNestedTypes().get(0); + internal_static_Action_AttributesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Action_AttributesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_Screen_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_Screen_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Screen_descriptor, + new java.lang.String[] { "Id", "Name", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/tech/donau/behaiv/proto/Data.java b/src/main/java/tech/donau/behaiv/proto/Data.java new file mode 100644 index 0000000..39ddec0 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/Data.java @@ -0,0 +1,627 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +/** + *
+ * Data messages
+ * 
+ * + * Protobuf type {@code Data} + */ +public final class Data extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Data) + DataOrBuilder { +private static final long serialVersionUID = 0L; + // Use Data.newBuilder() to construct. + private Data(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Data() { + key_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Data(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Data( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + 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; + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + key_ = s; + break; + } + case 25: { + + value_ = input.readDouble(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + 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 tech.donau.behaiv.proto.Behaiv.internal_static_Data_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Data_fieldAccessorTable + .ensureFieldAccessorsInitialized( + tech.donau.behaiv.proto.Data.class, tech.donau.behaiv.proto.Data.Builder.class); + } + + public static final int KEY_FIELD_NUMBER = 2; + private volatile java.lang.Object key_; + /** + * string key = 2; + * @return The key. + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * string key = 2; + * @return The bytes for key. + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALUE_FIELD_NUMBER = 3; + private double value_; + /** + * double value = 3; + * @return The value. + */ + public double getValue() { + return value_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getKeyBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, key_); + } + if (value_ != 0D) { + output.writeDouble(3, value_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getKeyBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, key_); + } + if (value_ != 0D) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(3, value_); + } + 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 tech.donau.behaiv.proto.Data)) { + return super.equals(obj); + } + tech.donau.behaiv.proto.Data other = (tech.donau.behaiv.proto.Data) obj; + + if (!getKey() + .equals(other.getKey())) return false; + if (java.lang.Double.doubleToLongBits(getValue()) + != java.lang.Double.doubleToLongBits( + other.getValue())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getValue())); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static tech.donau.behaiv.proto.Data parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Data parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Data parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Data parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Data parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Data parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Data parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Data 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 tech.donau.behaiv.proto.Data parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Data 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 tech.donau.behaiv.proto.Data parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Data parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(tech.donau.behaiv.proto.Data prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + 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; + } + /** + *
+   * Data messages
+   * 
+ * + * Protobuf type {@code Data} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:Data) + tech.donau.behaiv.proto.DataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Data_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Data_fieldAccessorTable + .ensureFieldAccessorsInitialized( + tech.donau.behaiv.proto.Data.class, tech.donau.behaiv.proto.Data.Builder.class); + } + + // Construct using tech.donau.behaiv.proto.Data.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + key_ = ""; + + value_ = 0D; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Data_descriptor; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Data getDefaultInstanceForType() { + return tech.donau.behaiv.proto.Data.getDefaultInstance(); + } + + @java.lang.Override + public tech.donau.behaiv.proto.Data build() { + tech.donau.behaiv.proto.Data result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Data buildPartial() { + tech.donau.behaiv.proto.Data result = new tech.donau.behaiv.proto.Data(this); + result.key_ = key_; + result.value_ = value_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof tech.donau.behaiv.proto.Data) { + return mergeFrom((tech.donau.behaiv.proto.Data)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(tech.donau.behaiv.proto.Data other) { + if (other == tech.donau.behaiv.proto.Data.getDefaultInstance()) return this; + if (!other.getKey().isEmpty()) { + key_ = other.key_; + onChanged(); + } + if (other.getValue() != 0D) { + setValue(other.getValue()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + tech.donau.behaiv.proto.Data parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (tech.donau.behaiv.proto.Data) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object key_ = ""; + /** + * string key = 2; + * @return The key. + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string key = 2; + * @return The bytes for key. + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string key = 2; + * @param value The key to set. + * @return This builder for chaining. + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + onChanged(); + return this; + } + /** + * string key = 2; + * @return This builder for chaining. + */ + public Builder clearKey() { + + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * string key = 2; + * @param value The bytes for key to set. + * @return This builder for chaining. + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value; + onChanged(); + return this; + } + + private double value_ ; + /** + * double value = 3; + * @return The value. + */ + public double getValue() { + return value_; + } + /** + * double value = 3; + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue(double value) { + + value_ = value; + onChanged(); + return this; + } + /** + * double value = 3; + * @return This builder for chaining. + */ + public Builder clearValue() { + + value_ = 0D; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:Data) + } + + // @@protoc_insertion_point(class_scope:Data) + private static final tech.donau.behaiv.proto.Data DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new tech.donau.behaiv.proto.Data(); + } + + public static tech.donau.behaiv.proto.Data getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Data parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Data(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Data getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java new file mode 100644 index 0000000..f82daf4 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public interface DataOrBuilder extends + // @@protoc_insertion_point(interface_extends:Data) + com.google.protobuf.MessageOrBuilder { + + /** + * string key = 2; + * @return The key. + */ + java.lang.String getKey(); + /** + * string key = 2; + * @return The bytes for key. + */ + com.google.protobuf.ByteString + getKeyBytes(); + + /** + * double value = 3; + * @return The value. + */ + double getValue(); +} diff --git a/src/main/java/tech/donau/behaiv/proto/Prediction.java b/src/main/java/tech/donau/behaiv/proto/Prediction.java new file mode 100644 index 0000000..a257ce7 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/Prediction.java @@ -0,0 +1,901 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +/** + * Protobuf type {@code Prediction} + */ +public final class Prediction extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Prediction) + PredictionOrBuilder { +private static final long serialVersionUID = 0L; + // Use Prediction.newBuilder() to construct. + private Prediction(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Prediction() { + data_ = java.util.Collections.emptyList(); + prediction_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Prediction(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Prediction( + 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; + case 10: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + data_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + data_.add( + input.readMessage(tech.donau.behaiv.proto.Data.parser(), extensionRegistry)); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + prediction_ = s; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + 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) != 0)) { + data_ = java.util.Collections.unmodifiableList(data_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Prediction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Prediction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + tech.donau.behaiv.proto.Prediction.class, tech.donau.behaiv.proto.Prediction.Builder.class); + } + + public static final int DATA_FIELD_NUMBER = 1; + private java.util.List data_; + /** + * repeated .Data data = 1; + */ + public java.util.List getDataList() { + return data_; + } + /** + * repeated .Data data = 1; + */ + public java.util.List + getDataOrBuilderList() { + return data_; + } + /** + * repeated .Data data = 1; + */ + public int getDataCount() { + return data_.size(); + } + /** + * repeated .Data data = 1; + */ + public tech.donau.behaiv.proto.Data getData(int index) { + return data_.get(index); + } + /** + * repeated .Data data = 1; + */ + public tech.donau.behaiv.proto.DataOrBuilder getDataOrBuilder( + int index) { + return data_.get(index); + } + + public static final int PREDICTION_FIELD_NUMBER = 2; + private volatile java.lang.Object prediction_; + /** + * string prediction = 2; + * @return The prediction. + */ + public java.lang.String getPrediction() { + java.lang.Object ref = prediction_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + prediction_ = s; + return s; + } + } + /** + * string prediction = 2; + * @return The bytes for prediction. + */ + public com.google.protobuf.ByteString + getPredictionBytes() { + java.lang.Object ref = prediction_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + prediction_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < data_.size(); i++) { + output.writeMessage(1, data_.get(i)); + } + if (!getPredictionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, prediction_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < data_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, data_.get(i)); + } + if (!getPredictionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, prediction_); + } + 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 tech.donau.behaiv.proto.Prediction)) { + return super.equals(obj); + } + tech.donau.behaiv.proto.Prediction other = (tech.donau.behaiv.proto.Prediction) obj; + + if (!getDataList() + .equals(other.getDataList())) return false; + if (!getPrediction() + .equals(other.getPrediction())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getDataCount() > 0) { + hash = (37 * hash) + DATA_FIELD_NUMBER; + hash = (53 * hash) + getDataList().hashCode(); + } + hash = (37 * hash) + PREDICTION_FIELD_NUMBER; + hash = (53 * hash) + getPrediction().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static tech.donau.behaiv.proto.Prediction parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Prediction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Prediction parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Prediction 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 tech.donau.behaiv.proto.Prediction parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Prediction 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 tech.donau.behaiv.proto.Prediction parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(tech.donau.behaiv.proto.Prediction prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + 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 Prediction} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:Prediction) + tech.donau.behaiv.proto.PredictionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Prediction_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Prediction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + tech.donau.behaiv.proto.Prediction.class, tech.donau.behaiv.proto.Prediction.Builder.class); + } + + // Construct using tech.donau.behaiv.proto.Prediction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getDataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (dataBuilder_ == null) { + data_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + dataBuilder_.clear(); + } + prediction_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Prediction_descriptor; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Prediction getDefaultInstanceForType() { + return tech.donau.behaiv.proto.Prediction.getDefaultInstance(); + } + + @java.lang.Override + public tech.donau.behaiv.proto.Prediction build() { + tech.donau.behaiv.proto.Prediction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Prediction buildPartial() { + tech.donau.behaiv.proto.Prediction result = new tech.donau.behaiv.proto.Prediction(this); + int from_bitField0_ = bitField0_; + if (dataBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + data_ = java.util.Collections.unmodifiableList(data_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.data_ = data_; + } else { + result.data_ = dataBuilder_.build(); + } + result.prediction_ = prediction_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof tech.donau.behaiv.proto.Prediction) { + return mergeFrom((tech.donau.behaiv.proto.Prediction)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(tech.donau.behaiv.proto.Prediction other) { + if (other == tech.donau.behaiv.proto.Prediction.getDefaultInstance()) return this; + if (dataBuilder_ == null) { + if (!other.data_.isEmpty()) { + if (data_.isEmpty()) { + data_ = other.data_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureDataIsMutable(); + data_.addAll(other.data_); + } + onChanged(); + } + } else { + if (!other.data_.isEmpty()) { + if (dataBuilder_.isEmpty()) { + dataBuilder_.dispose(); + dataBuilder_ = null; + data_ = other.data_; + bitField0_ = (bitField0_ & ~0x00000001); + dataBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getDataFieldBuilder() : null; + } else { + dataBuilder_.addAllMessages(other.data_); + } + } + } + if (!other.getPrediction().isEmpty()) { + prediction_ = other.prediction_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + tech.donau.behaiv.proto.Prediction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (tech.donau.behaiv.proto.Prediction) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List data_ = + java.util.Collections.emptyList(); + private void ensureDataIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + data_ = new java.util.ArrayList(data_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + tech.donau.behaiv.proto.Data, tech.donau.behaiv.proto.Data.Builder, tech.donau.behaiv.proto.DataOrBuilder> dataBuilder_; + + /** + * repeated .Data data = 1; + */ + public java.util.List getDataList() { + if (dataBuilder_ == null) { + return java.util.Collections.unmodifiableList(data_); + } else { + return dataBuilder_.getMessageList(); + } + } + /** + * repeated .Data data = 1; + */ + public int getDataCount() { + if (dataBuilder_ == null) { + return data_.size(); + } else { + return dataBuilder_.getCount(); + } + } + /** + * repeated .Data data = 1; + */ + public tech.donau.behaiv.proto.Data getData(int index) { + if (dataBuilder_ == null) { + return data_.get(index); + } else { + return dataBuilder_.getMessage(index); + } + } + /** + * repeated .Data data = 1; + */ + public Builder setData( + int index, tech.donau.behaiv.proto.Data value) { + if (dataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDataIsMutable(); + data_.set(index, value); + onChanged(); + } else { + dataBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder setData( + int index, tech.donau.behaiv.proto.Data.Builder builderForValue) { + if (dataBuilder_ == null) { + ensureDataIsMutable(); + data_.set(index, builderForValue.build()); + onChanged(); + } else { + dataBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder addData(tech.donau.behaiv.proto.Data value) { + if (dataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDataIsMutable(); + data_.add(value); + onChanged(); + } else { + dataBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder addData( + int index, tech.donau.behaiv.proto.Data value) { + if (dataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDataIsMutable(); + data_.add(index, value); + onChanged(); + } else { + dataBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder addData( + tech.donau.behaiv.proto.Data.Builder builderForValue) { + if (dataBuilder_ == null) { + ensureDataIsMutable(); + data_.add(builderForValue.build()); + onChanged(); + } else { + dataBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder addData( + int index, tech.donau.behaiv.proto.Data.Builder builderForValue) { + if (dataBuilder_ == null) { + ensureDataIsMutable(); + data_.add(index, builderForValue.build()); + onChanged(); + } else { + dataBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder addAllData( + java.lang.Iterable values) { + if (dataBuilder_ == null) { + ensureDataIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, data_); + onChanged(); + } else { + dataBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder clearData() { + if (dataBuilder_ == null) { + data_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + dataBuilder_.clear(); + } + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder removeData(int index) { + if (dataBuilder_ == null) { + ensureDataIsMutable(); + data_.remove(index); + onChanged(); + } else { + dataBuilder_.remove(index); + } + return this; + } + /** + * repeated .Data data = 1; + */ + public tech.donau.behaiv.proto.Data.Builder getDataBuilder( + int index) { + return getDataFieldBuilder().getBuilder(index); + } + /** + * repeated .Data data = 1; + */ + public tech.donau.behaiv.proto.DataOrBuilder getDataOrBuilder( + int index) { + if (dataBuilder_ == null) { + return data_.get(index); } else { + return dataBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .Data data = 1; + */ + public java.util.List + getDataOrBuilderList() { + if (dataBuilder_ != null) { + return dataBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(data_); + } + } + /** + * repeated .Data data = 1; + */ + public tech.donau.behaiv.proto.Data.Builder addDataBuilder() { + return getDataFieldBuilder().addBuilder( + tech.donau.behaiv.proto.Data.getDefaultInstance()); + } + /** + * repeated .Data data = 1; + */ + public tech.donau.behaiv.proto.Data.Builder addDataBuilder( + int index) { + return getDataFieldBuilder().addBuilder( + index, tech.donau.behaiv.proto.Data.getDefaultInstance()); + } + /** + * repeated .Data data = 1; + */ + public java.util.List + getDataBuilderList() { + return getDataFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + tech.donau.behaiv.proto.Data, tech.donau.behaiv.proto.Data.Builder, tech.donau.behaiv.proto.DataOrBuilder> + getDataFieldBuilder() { + if (dataBuilder_ == null) { + dataBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + tech.donau.behaiv.proto.Data, tech.donau.behaiv.proto.Data.Builder, tech.donau.behaiv.proto.DataOrBuilder>( + data_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + data_ = null; + } + return dataBuilder_; + } + + private java.lang.Object prediction_ = ""; + /** + * string prediction = 2; + * @return The prediction. + */ + public java.lang.String getPrediction() { + java.lang.Object ref = prediction_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + prediction_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string prediction = 2; + * @return The bytes for prediction. + */ + public com.google.protobuf.ByteString + getPredictionBytes() { + java.lang.Object ref = prediction_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + prediction_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string prediction = 2; + * @param value The prediction to set. + * @return This builder for chaining. + */ + public Builder setPrediction( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + prediction_ = value; + onChanged(); + return this; + } + /** + * string prediction = 2; + * @return This builder for chaining. + */ + public Builder clearPrediction() { + + prediction_ = getDefaultInstance().getPrediction(); + onChanged(); + return this; + } + /** + * string prediction = 2; + * @param value The bytes for prediction to set. + * @return This builder for chaining. + */ + public Builder setPredictionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + prediction_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:Prediction) + } + + // @@protoc_insertion_point(class_scope:Prediction) + private static final tech.donau.behaiv.proto.Prediction DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new tech.donau.behaiv.proto.Prediction(); + } + + public static tech.donau.behaiv.proto.Prediction getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Prediction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Prediction(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Prediction getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java new file mode 100644 index 0000000..db9546a --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java @@ -0,0 +1,45 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public interface PredictionOrBuilder extends + // @@protoc_insertion_point(interface_extends:Prediction) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated .Data data = 1; + */ + java.util.List + getDataList(); + /** + * repeated .Data data = 1; + */ + tech.donau.behaiv.proto.Data getData(int index); + /** + * repeated .Data data = 1; + */ + int getDataCount(); + /** + * repeated .Data data = 1; + */ + java.util.List + getDataOrBuilderList(); + /** + * repeated .Data data = 1; + */ + tech.donau.behaiv.proto.DataOrBuilder getDataOrBuilder( + int index); + + /** + * string prediction = 2; + * @return The prediction. + */ + java.lang.String getPrediction(); + /** + * string prediction = 2; + * @return The bytes for prediction. + */ + com.google.protobuf.ByteString + getPredictionBytes(); +} diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionSet.java b/src/main/java/tech/donau/behaiv/proto/PredictionSet.java new file mode 100644 index 0000000..bc2fb05 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/PredictionSet.java @@ -0,0 +1,765 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +/** + * Protobuf type {@code PredictionSet} + */ +public final class PredictionSet extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:PredictionSet) + PredictionSetOrBuilder { +private static final long serialVersionUID = 0L; + // Use PredictionSet.newBuilder() to construct. + private PredictionSet(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private PredictionSet() { + prediction_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new PredictionSet(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private PredictionSet( + 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; + case 10: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + prediction_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + prediction_.add( + input.readMessage(tech.donau.behaiv.proto.Prediction.parser(), extensionRegistry)); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + 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) != 0)) { + prediction_ = java.util.Collections.unmodifiableList(prediction_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return tech.donau.behaiv.proto.Behaiv.internal_static_PredictionSet_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return tech.donau.behaiv.proto.Behaiv.internal_static_PredictionSet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + tech.donau.behaiv.proto.PredictionSet.class, tech.donau.behaiv.proto.PredictionSet.Builder.class); + } + + public static final int PREDICTION_FIELD_NUMBER = 1; + private java.util.List prediction_; + /** + * repeated .Prediction prediction = 1; + */ + public java.util.List getPredictionList() { + return prediction_; + } + /** + * repeated .Prediction prediction = 1; + */ + public java.util.List + getPredictionOrBuilderList() { + return prediction_; + } + /** + * repeated .Prediction prediction = 1; + */ + public int getPredictionCount() { + return prediction_.size(); + } + /** + * repeated .Prediction prediction = 1; + */ + public tech.donau.behaiv.proto.Prediction getPrediction(int index) { + return prediction_.get(index); + } + /** + * repeated .Prediction prediction = 1; + */ + public tech.donau.behaiv.proto.PredictionOrBuilder getPredictionOrBuilder( + int index) { + return prediction_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < prediction_.size(); i++) { + output.writeMessage(1, prediction_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < prediction_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, prediction_.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 tech.donau.behaiv.proto.PredictionSet)) { + return super.equals(obj); + } + tech.donau.behaiv.proto.PredictionSet other = (tech.donau.behaiv.proto.PredictionSet) obj; + + if (!getPredictionList() + .equals(other.getPredictionList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getPredictionCount() > 0) { + hash = (37 * hash) + PREDICTION_FIELD_NUMBER; + hash = (53 * hash) + getPredictionList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.PredictionSet 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 tech.donau.behaiv.proto.PredictionSet parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.PredictionSet 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 tech.donau.behaiv.proto.PredictionSet parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(tech.donau.behaiv.proto.PredictionSet prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + 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 PredictionSet} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:PredictionSet) + tech.donau.behaiv.proto.PredictionSetOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return tech.donau.behaiv.proto.Behaiv.internal_static_PredictionSet_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return tech.donau.behaiv.proto.Behaiv.internal_static_PredictionSet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + tech.donau.behaiv.proto.PredictionSet.class, tech.donau.behaiv.proto.PredictionSet.Builder.class); + } + + // Construct using tech.donau.behaiv.proto.PredictionSet.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getPredictionFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (predictionBuilder_ == null) { + prediction_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + predictionBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return tech.donau.behaiv.proto.Behaiv.internal_static_PredictionSet_descriptor; + } + + @java.lang.Override + public tech.donau.behaiv.proto.PredictionSet getDefaultInstanceForType() { + return tech.donau.behaiv.proto.PredictionSet.getDefaultInstance(); + } + + @java.lang.Override + public tech.donau.behaiv.proto.PredictionSet build() { + tech.donau.behaiv.proto.PredictionSet result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public tech.donau.behaiv.proto.PredictionSet buildPartial() { + tech.donau.behaiv.proto.PredictionSet result = new tech.donau.behaiv.proto.PredictionSet(this); + int from_bitField0_ = bitField0_; + if (predictionBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + prediction_ = java.util.Collections.unmodifiableList(prediction_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.prediction_ = prediction_; + } else { + result.prediction_ = predictionBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof tech.donau.behaiv.proto.PredictionSet) { + return mergeFrom((tech.donau.behaiv.proto.PredictionSet)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(tech.donau.behaiv.proto.PredictionSet other) { + if (other == tech.donau.behaiv.proto.PredictionSet.getDefaultInstance()) return this; + if (predictionBuilder_ == null) { + if (!other.prediction_.isEmpty()) { + if (prediction_.isEmpty()) { + prediction_ = other.prediction_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensurePredictionIsMutable(); + prediction_.addAll(other.prediction_); + } + onChanged(); + } + } else { + if (!other.prediction_.isEmpty()) { + if (predictionBuilder_.isEmpty()) { + predictionBuilder_.dispose(); + predictionBuilder_ = null; + prediction_ = other.prediction_; + bitField0_ = (bitField0_ & ~0x00000001); + predictionBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getPredictionFieldBuilder() : null; + } else { + predictionBuilder_.addAllMessages(other.prediction_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + tech.donau.behaiv.proto.PredictionSet parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (tech.donau.behaiv.proto.PredictionSet) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List prediction_ = + java.util.Collections.emptyList(); + private void ensurePredictionIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + prediction_ = new java.util.ArrayList(prediction_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + tech.donau.behaiv.proto.Prediction, tech.donau.behaiv.proto.Prediction.Builder, tech.donau.behaiv.proto.PredictionOrBuilder> predictionBuilder_; + + /** + * repeated .Prediction prediction = 1; + */ + public java.util.List getPredictionList() { + if (predictionBuilder_ == null) { + return java.util.Collections.unmodifiableList(prediction_); + } else { + return predictionBuilder_.getMessageList(); + } + } + /** + * repeated .Prediction prediction = 1; + */ + public int getPredictionCount() { + if (predictionBuilder_ == null) { + return prediction_.size(); + } else { + return predictionBuilder_.getCount(); + } + } + /** + * repeated .Prediction prediction = 1; + */ + public tech.donau.behaiv.proto.Prediction getPrediction(int index) { + if (predictionBuilder_ == null) { + return prediction_.get(index); + } else { + return predictionBuilder_.getMessage(index); + } + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder setPrediction( + int index, tech.donau.behaiv.proto.Prediction value) { + if (predictionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePredictionIsMutable(); + prediction_.set(index, value); + onChanged(); + } else { + predictionBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder setPrediction( + int index, tech.donau.behaiv.proto.Prediction.Builder builderForValue) { + if (predictionBuilder_ == null) { + ensurePredictionIsMutable(); + prediction_.set(index, builderForValue.build()); + onChanged(); + } else { + predictionBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder addPrediction(tech.donau.behaiv.proto.Prediction value) { + if (predictionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePredictionIsMutable(); + prediction_.add(value); + onChanged(); + } else { + predictionBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder addPrediction( + int index, tech.donau.behaiv.proto.Prediction value) { + if (predictionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePredictionIsMutable(); + prediction_.add(index, value); + onChanged(); + } else { + predictionBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder addPrediction( + tech.donau.behaiv.proto.Prediction.Builder builderForValue) { + if (predictionBuilder_ == null) { + ensurePredictionIsMutable(); + prediction_.add(builderForValue.build()); + onChanged(); + } else { + predictionBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder addPrediction( + int index, tech.donau.behaiv.proto.Prediction.Builder builderForValue) { + if (predictionBuilder_ == null) { + ensurePredictionIsMutable(); + prediction_.add(index, builderForValue.build()); + onChanged(); + } else { + predictionBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder addAllPrediction( + java.lang.Iterable values) { + if (predictionBuilder_ == null) { + ensurePredictionIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, prediction_); + onChanged(); + } else { + predictionBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder clearPrediction() { + if (predictionBuilder_ == null) { + prediction_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + predictionBuilder_.clear(); + } + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder removePrediction(int index) { + if (predictionBuilder_ == null) { + ensurePredictionIsMutable(); + prediction_.remove(index); + onChanged(); + } else { + predictionBuilder_.remove(index); + } + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public tech.donau.behaiv.proto.Prediction.Builder getPredictionBuilder( + int index) { + return getPredictionFieldBuilder().getBuilder(index); + } + /** + * repeated .Prediction prediction = 1; + */ + public tech.donau.behaiv.proto.PredictionOrBuilder getPredictionOrBuilder( + int index) { + if (predictionBuilder_ == null) { + return prediction_.get(index); } else { + return predictionBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .Prediction prediction = 1; + */ + public java.util.List + getPredictionOrBuilderList() { + if (predictionBuilder_ != null) { + return predictionBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(prediction_); + } + } + /** + * repeated .Prediction prediction = 1; + */ + public tech.donau.behaiv.proto.Prediction.Builder addPredictionBuilder() { + return getPredictionFieldBuilder().addBuilder( + tech.donau.behaiv.proto.Prediction.getDefaultInstance()); + } + /** + * repeated .Prediction prediction = 1; + */ + public tech.donau.behaiv.proto.Prediction.Builder addPredictionBuilder( + int index) { + return getPredictionFieldBuilder().addBuilder( + index, tech.donau.behaiv.proto.Prediction.getDefaultInstance()); + } + /** + * repeated .Prediction prediction = 1; + */ + public java.util.List + getPredictionBuilderList() { + return getPredictionFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + tech.donau.behaiv.proto.Prediction, tech.donau.behaiv.proto.Prediction.Builder, tech.donau.behaiv.proto.PredictionOrBuilder> + getPredictionFieldBuilder() { + if (predictionBuilder_ == null) { + predictionBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + tech.donau.behaiv.proto.Prediction, tech.donau.behaiv.proto.Prediction.Builder, tech.donau.behaiv.proto.PredictionOrBuilder>( + prediction_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + prediction_ = null; + } + return predictionBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:PredictionSet) + } + + // @@protoc_insertion_point(class_scope:PredictionSet) + private static final tech.donau.behaiv.proto.PredictionSet DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new tech.donau.behaiv.proto.PredictionSet(); + } + + public static tech.donau.behaiv.proto.PredictionSet getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PredictionSet parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PredictionSet(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public tech.donau.behaiv.proto.PredictionSet getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java new file mode 100644 index 0000000..8252e1d --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java @@ -0,0 +1,33 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public interface PredictionSetOrBuilder extends + // @@protoc_insertion_point(interface_extends:PredictionSet) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated .Prediction prediction = 1; + */ + java.util.List + getPredictionList(); + /** + * repeated .Prediction prediction = 1; + */ + tech.donau.behaiv.proto.Prediction getPrediction(int index); + /** + * repeated .Prediction prediction = 1; + */ + int getPredictionCount(); + /** + * repeated .Prediction prediction = 1; + */ + java.util.List + getPredictionOrBuilderList(); + /** + * repeated .Prediction prediction = 1; + */ + tech.donau.behaiv.proto.PredictionOrBuilder getPredictionOrBuilder( + int index); +} diff --git a/src/main/java/tech/donau/behaiv/proto/Screen.java b/src/main/java/tech/donau/behaiv/proto/Screen.java new file mode 100644 index 0000000..0c80fe3 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/Screen.java @@ -0,0 +1,617 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +/** + * Protobuf type {@code Screen} + */ +public final class Screen extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Screen) + ScreenOrBuilder { +private static final long serialVersionUID = 0L; + // Use Screen.newBuilder() to construct. + private Screen(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Screen() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Screen(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Screen( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + 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; + case 8: { + + id_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + 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 tech.donau.behaiv.proto.Behaiv.internal_static_Screen_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Screen_fieldAccessorTable + .ensureFieldAccessorsInitialized( + tech.donau.behaiv.proto.Screen.class, tech.donau.behaiv.proto.Screen.Builder.class); + } + + public static final int ID_FIELD_NUMBER = 1; + private int id_; + /** + * int32 id = 1; + * @return The id. + */ + public int getId() { + return id_; + } + + public static final int NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object name_; + /** + * string name = 2; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * string name = 2; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (id_ != 0) { + output.writeInt32(1, id_); + } + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (id_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, id_); + } + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_); + } + 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 tech.donau.behaiv.proto.Screen)) { + return super.equals(obj); + } + tech.donau.behaiv.proto.Screen other = (tech.donau.behaiv.proto.Screen) obj; + + if (getId() + != other.getId()) return false; + if (!getName() + .equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static tech.donau.behaiv.proto.Screen parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Screen parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Screen parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Screen 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 tech.donau.behaiv.proto.Screen parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Screen 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 tech.donau.behaiv.proto.Screen parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(tech.donau.behaiv.proto.Screen prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + 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 Screen} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:Screen) + tech.donau.behaiv.proto.ScreenOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Screen_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Screen_fieldAccessorTable + .ensureFieldAccessorsInitialized( + tech.donau.behaiv.proto.Screen.class, tech.donau.behaiv.proto.Screen.Builder.class); + } + + // Construct using tech.donau.behaiv.proto.Screen.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + id_ = 0; + + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return tech.donau.behaiv.proto.Behaiv.internal_static_Screen_descriptor; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Screen getDefaultInstanceForType() { + return tech.donau.behaiv.proto.Screen.getDefaultInstance(); + } + + @java.lang.Override + public tech.donau.behaiv.proto.Screen build() { + tech.donau.behaiv.proto.Screen result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Screen buildPartial() { + tech.donau.behaiv.proto.Screen result = new tech.donau.behaiv.proto.Screen(this); + result.id_ = id_; + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof tech.donau.behaiv.proto.Screen) { + return mergeFrom((tech.donau.behaiv.proto.Screen)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(tech.donau.behaiv.proto.Screen other) { + if (other == tech.donau.behaiv.proto.Screen.getDefaultInstance()) return this; + if (other.getId() != 0) { + setId(other.getId()); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + tech.donau.behaiv.proto.Screen parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (tech.donau.behaiv.proto.Screen) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int id_ ; + /** + * int32 id = 1; + * @return The id. + */ + public int getId() { + return id_; + } + /** + * int32 id = 1; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId(int value) { + + id_ = value; + onChanged(); + return this; + } + /** + * int32 id = 1; + * @return This builder for chaining. + */ + public Builder clearId() { + + id_ = 0; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + * string name = 2; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string name = 2; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string name = 2; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * string name = 2; + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * string name = 2; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:Screen) + } + + // @@protoc_insertion_point(class_scope:Screen) + private static final tech.donau.behaiv.proto.Screen DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new tech.donau.behaiv.proto.Screen(); + } + + public static tech.donau.behaiv.proto.Screen getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Screen parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Screen(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public tech.donau.behaiv.proto.Screen getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java new file mode 100644 index 0000000..e258da2 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public interface ScreenOrBuilder extends + // @@protoc_insertion_point(interface_extends:Screen) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 id = 1; + * @return The id. + */ + int getId(); + + /** + * string name = 2; + * @return The name. + */ + java.lang.String getName(); + /** + * string name = 2; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} From 9eb81f55ad8b1ea619e6662214e4f8b0a4f19d00 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 10:46:32 +0100 Subject: [PATCH 03/23] Added method to convert List,String> to PredictionSet --- .../dmi3y/behaiv/tools/DataMappingUtils.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java index a66f278..718b98a 100644 --- a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java +++ b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java @@ -1,6 +1,9 @@ package de.dmi3y.behaiv.tools; import org.apache.commons.lang3.ArrayUtils; +import tech.donau.behaiv.proto.Data; +import tech.donau.behaiv.proto.Prediction; +import tech.donau.behaiv.proto.PredictionSet; import java.util.ArrayList; import java.util.HashSet; @@ -14,6 +17,23 @@ private DataMappingUtils() { // Unused utility class } + public static PredictionSet createPredictionSet(List, String>> data) { + final PredictionSet.Builder predictionSetBuilder = PredictionSet.newBuilder(); + for (int i = 0; i < data.size(); i++) { + final List weights = data.get(i).getKey(); + final ArrayList row = new ArrayList<>(); + for (int j = 0; j < weights.size(); j++) { + row.add(Data.newBuilder().setKey("key"+j).setValue(weights.get(j)).build()); + } + predictionSetBuilder.addPrediction( + Prediction.newBuilder() + .addAllData(row) + .setPrediction(data.get(i).getValue()) + .build() + ); + } + return predictionSetBuilder.build(); + } public static List toDistinctListOfPairValues(List, String>> data) { Set setOfValues = new HashSet<>(); From fb4bcb2948cce7f6fdd3fa3a3d5749b9f1a76e39 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 12:30:56 +0100 Subject: [PATCH 04/23] Test for DataMappingUtilsTest::createPredictionSet --- .../dmi3y/behaiv/tools/DataMappingUtilsTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java b/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java index 09e218e..f9f5f50 100644 --- a/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java +++ b/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java @@ -2,6 +2,8 @@ import org.junit.Test; import org.mockito.internal.matchers.Null; +import tech.donau.behaiv.proto.Prediction; +import tech.donau.behaiv.proto.PredictionSet; import java.util.ArrayList; import java.util.Arrays; @@ -13,6 +15,19 @@ public class DataMappingUtilsTest { + + @Test + public void createPredictionSet_feedDefaultTestData_expectCorrectOrder() { + final Pair, String> mockData = getMockPairListDoubleStringData(); + final PredictionSet predictionSet = DataMappingUtils.createPredictionSet(Collections.singletonList(mockData)); + assertEquals(1, predictionSet.getPredictionCount()); + final Prediction prediction = predictionSet.getPrediction(0); + assertEquals("Potato", prediction.getPrediction()); + assertEquals(1, prediction.getDataCount()); + assertEquals("key0", prediction.getData(0).getKey()); + assertEquals(20d, prediction.getData(0).getValue(), 0); + } + @Test public void toDistinctListOfPairValues_withInputData_returnsExpectedDistinctListOfPairValues() { List, String>> mockData = Arrays.asList( From 965501579fd094486480149b6c4a6301563429c3 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 12:31:49 +0100 Subject: [PATCH 05/23] Deprecated old Kernel::fit --- src/main/java/de/dmi3y/behaiv/kernel/Kernel.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java b/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java index b2db896..3535129 100644 --- a/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java +++ b/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java @@ -11,6 +11,7 @@ public interface Kernel { boolean isEmpty(); + @Deprecated void fit(List, String>> data); void fit(); From a2066c3cf4fd8acec4863a5cbebb14ef35e118d0 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 19:44:51 +0100 Subject: [PATCH 06/23] Refactored Behaiv to use PredictionSet instead of lists --- .../de/dmi3y/behaiv/kernel/BaseKernel.java | 37 ++++--- .../java/de/dmi3y/behaiv/kernel/Kernel.java | 3 + .../kernel/LogisticRegressionKernel.java | 85 ++++++++++++---- .../dmi3y/behaiv/tools/DataMappingUtils.java | 27 ++++-- .../java/tech/donau/behaiv/proto/Behaiv.java | 27 +++--- .../tech/donau/behaiv/proto/Prediction.java | 96 +++++++++---------- .../behaiv/proto/PredictionOrBuilder.java | 12 +-- .../donau/behaiv/proto/PredictionSet.java | 63 ++++++++++++ .../behaiv/proto/PredictionSetOrBuilder.java | 6 ++ .../de/dmi3y/behaiv/kernel/KernelTest.java | 10 +- .../kernel/LogisticRegressionKernelTest.java | 9 +- .../behaiv/tools/DataMappingUtilsTest.java | 13 ++- 12 files changed, 263 insertions(+), 125 deletions(-) diff --git a/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java b/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java index 04ef86b..e2a4bb5 100644 --- a/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java +++ b/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java @@ -1,14 +1,14 @@ package de.dmi3y.behaiv.kernel; -import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import de.dmi3y.behaiv.storage.BehaivStorage; import de.dmi3y.behaiv.tools.Pair; +import tech.donau.behaiv.proto.Data; +import tech.donau.behaiv.proto.Prediction; +import tech.donau.behaiv.proto.PredictionSet; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.FileReader; -import java.io.FileWriter; +import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -34,7 +34,7 @@ public void setId(String id) { //list, label - protected List, String>> data = new ArrayList<>(); + protected PredictionSet data = PredictionSet.newBuilder().addAllPrediction(new ArrayList()).build(); @Override @@ -49,7 +49,7 @@ public void setTreshold(Long treshold) { @Override public boolean readyToPredict() { - return data.size() > treshold; + return data.getPredictionList().size() > treshold; } @Override @@ -63,7 +63,12 @@ public boolean isPartialFitAllowed() { @Override public void updateSingle(List features, String label) { - data.add(new Pair<>(features, label)); + final Prediction.Builder predictionBuilder = Prediction.newBuilder(); + for (int i = 0; i < features.size(); i++) { + predictionBuilder.addData(Data.newBuilder().setKey("key" + i).setValue(features.get(i)).build()); + } + predictionBuilder.setLabel(label); + data = data.toBuilder().addPrediction(predictionBuilder.build()).build(); } @Override @@ -78,23 +83,15 @@ public void setAlwaysKeepData(boolean alwaysKeepData) { @Override public void save(BehaivStorage storage) throws IOException { - - try (final BufferedWriter writer = new BufferedWriter(new FileWriter(storage.getDataFile(id)))) { - writer.write(objectMapper.writeValueAsString(data)); + try (final FileOutputStream writer = new FileOutputStream(storage.getDataFile(id))) { + data.writeTo(writer); } } @Override public void restore(BehaivStorage storage) throws IOException { - final TypeReference, String>>> typeReference = new TypeReference, String>>>() { - }; - try (final BufferedReader reader = new BufferedReader(new FileReader(storage.getDataFile(id)))) { - final String content = reader.readLine(); - if (content == null || content.isEmpty()) { - data = new ArrayList<>(); - } else { - data = objectMapper.readValue(content, typeReference); - } + try (final FileInputStream reader = new FileInputStream(storage.getDataFile(id))) { + data = PredictionSet.parseFrom(reader); } } } diff --git a/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java b/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java index 3535129..8f915fa 100644 --- a/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java +++ b/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java @@ -2,6 +2,7 @@ import de.dmi3y.behaiv.storage.BehaivStorage; import de.dmi3y.behaiv.tools.Pair; +import tech.donau.behaiv.proto.PredictionSet; import java.io.IOException; import java.util.List; @@ -14,6 +15,8 @@ public interface Kernel { @Deprecated void fit(List, String>> data); + void fit(PredictionSet data); + void fit(); void setTreshold(Long treshold); diff --git a/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java b/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java index 3337192..f15a9e6 100644 --- a/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java +++ b/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java @@ -3,23 +3,27 @@ import com.fasterxml.jackson.core.type.TypeReference; import de.dmi3y.behaiv.kernel.logistic.LogisticUtils; import de.dmi3y.behaiv.storage.BehaivStorage; +import de.dmi3y.behaiv.tools.DataMappingUtils; import de.dmi3y.behaiv.tools.Pair; import org.apache.commons.lang3.ArrayUtils; import org.ejml.simple.SimpleMatrix; +import tech.donau.behaiv.proto.PredictionSet; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; import static de.dmi3y.behaiv.tools.DataMappingUtils.toDistinctListOfPairValues; import static de.dmi3y.behaiv.tools.DataMappingUtils.toInput2dArray; public class LogisticRegressionKernel extends BaseKernel { - protected List labels = new ArrayList<>(); + protected List cachedLables = new ArrayList<>(); private Random rand; protected SimpleMatrix theta; @@ -35,24 +39,64 @@ public LogisticRegressionKernel(String id) { @Override public boolean isEmpty() { - return theta == null && data.size() == 0; + return theta == null && data.getPredictionCount() == 0; } - @Override - public void fit(List, String>> data) { + public void fit(PredictionSet data) { this.data = data; - labels = toDistinctListOfPairValues(data); + if (data.getDynamicColumns()) { + throw new UnsupportedOperationException("LogisticRegressionKernel doesn't support dynamic fields"); + } + for (int i = 0; i < data.getPredictionList().size(); i++) { + cachedLables.add(data.getPredictionList().get(i).getLabel()); + } if (readyToPredict()) { + //features + double[][] inputs = toInput2dArray(data); + + //labels + double[][] labelArray = new double[data.getPredictionCount()][cachedLables.size()]; + for (int i = 0; i < data.getPredictionCount(); i++) { + int dummyPos = cachedLables.indexOf(data.getPrediction(i).getLabel()); + labelArray[i][dummyPos] = 1.0; + } + + //output layer + final SimpleMatrix inputMatrix = new SimpleMatrix(inputs); + final SimpleMatrix outputMatrix = new SimpleMatrix(labelArray); + //3x4? + + //TODO dilemma on if we need to re-do theta or keep it as-is, if new features arrising we'll have a problem + if (theta == null || (theta.numCols() != cachedLables.size() && alwaysKeepData)) { + theta = SimpleMatrix.random_DDRM(inputMatrix.numCols(), outputMatrix.numCols(), 0, 1, rand); + } else if (theta.numCols() != cachedLables.size() && !alwaysKeepData) { + throw new UnsupportedOperationException( + "Partial fit of LogisticRegressionKernel is not supported. " + + "Number of labels differs from trained model." + + " Consider setting alwaysKeepData to true or changing Kernel that supports partial fit." + ); + } + + for (int i = 0; i < 10000; i++) { + theta = LogisticUtils.gradientDescent(inputMatrix, theta, outputMatrix, 0.1); + } + } + } + @Override + public void fit(List, String>> data) { + this.data = DataMappingUtils.createPredictionSet(data); + this.cachedLables = toDistinctListOfPairValues(data); + if (readyToPredict()) { //features double[][] inputs = toInput2dArray(data); //labels - double[][] labelArray = new double[data.size()][labels.size()]; + double[][] labelArray = new double[data.size()][cachedLables.size()]; for (int i = 0; i < data.size(); i++) { - int dummyPos = labels.indexOf(data.get(i).getValue()); + int dummyPos = cachedLables.indexOf(data.get(i).getValue()); labelArray[i][dummyPos] = 1.0; } @@ -62,9 +106,9 @@ public void fit(List, String>> data) { //3x4? //TODO dilemma on if we need to re-do theta or keep it as-is, if new features arrising we'll have a problem - if (theta == null || (theta.numCols() != labels.size() && alwaysKeepData)) { + if (theta == null || (theta.numCols() != cachedLables.size() && alwaysKeepData)) { theta = SimpleMatrix.random_DDRM(inputMatrix.numCols(), outputMatrix.numCols(), 0, 1, rand); - } else if (theta.numCols() != labels.size() && !alwaysKeepData) { + } else if (theta.numCols() != cachedLables.size() && !alwaysKeepData) { throw new UnsupportedOperationException( "Partial fit of LogisticRegressionKernel is not supported. " + "Number of labels differs from trained model." + @@ -92,8 +136,6 @@ public void updateSingle(List features, String label) { @Override public String predictOne(List features) { - - final double[] doubles = ArrayUtils.toPrimitive(features.toArray(new Double[0])); final SimpleMatrix inputs = new SimpleMatrix(new double[][]{doubles}); @@ -106,18 +148,21 @@ public String predictOne(List features) { maxPosition = i; } } - return labels.get(maxPosition); + return cachedLables.get(maxPosition); } @Override public void save(BehaivStorage storage) throws IOException { - if (theta == null && (data == null || data.isEmpty())) { + if (theta == null && (data == null || data.getPredictionList().isEmpty())) { throw new IOException("Not enough data to save, network data is empty"); } - if(labels == null || labels.isEmpty()) { - labels = toDistinctListOfPairValues(data); + if (cachedLables == null || cachedLables.isEmpty()) { + cachedLables = new ArrayList<>(); + for (int i = 0; i < data.getPredictionList().size(); i++) { + cachedLables.add(data.getPredictionList().get(i).getLabel()); + } } - if (labels.isEmpty()) { + if (cachedLables.isEmpty()) { String message; message = "Kernel collected data but failed to get labels, couldn't save network."; throw new IOException(message); @@ -131,7 +176,7 @@ public void save(BehaivStorage storage) throws IOException { theta.saveToFileBinary(storage.getNetworkFile(id).toString()); try (final BufferedWriter writer = new BufferedWriter(new FileWriter(storage.getNetworkMetadataFile(id)))) { - writer.write(objectMapper.writeValueAsString(labels)); + writer.write(objectMapper.writeValueAsString(cachedLables)); } catch (Exception e) { e.printStackTrace(); } @@ -157,9 +202,9 @@ public void restore(BehaivStorage storage) throws IOException { }; final String labelsData = reader.readLine(); if (labelsData == null) { - labels = new ArrayList<>(); + cachedLables = new ArrayList<>(); } else { - labels = objectMapper.readValue(labelsData, typeReference); + cachedLables = objectMapper.readValue(labelsData, typeReference); } } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java index 718b98a..94cc1d7 100644 --- a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java +++ b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java @@ -10,8 +10,7 @@ import java.util.List; import java.util.Set; -public final class DataMappingUtils -{ +public final class DataMappingUtils { private DataMappingUtils() { // Unused utility class @@ -23,21 +22,21 @@ public static PredictionSet createPredictionSet(List, String>> final List weights = data.get(i).getKey(); final ArrayList row = new ArrayList<>(); for (int j = 0; j < weights.size(); j++) { - row.add(Data.newBuilder().setKey("key"+j).setValue(weights.get(j)).build()); + row.add(Data.newBuilder().setKey("key" + j).setValue(weights.get(j)).build()); } predictionSetBuilder.addPrediction( Prediction.newBuilder() .addAllData(row) - .setPrediction(data.get(i).getValue()) + .setLabel(data.get(i).getValue()) .build() ); } - return predictionSetBuilder.build(); + return predictionSetBuilder.buildPartial(); } public static List toDistinctListOfPairValues(List, String>> data) { Set setOfValues = new HashSet<>(); - for(Pair, String> arrayListStringPair : data ) { + for (Pair, String> arrayListStringPair : data) { setOfValues.add(arrayListStringPair.getValue()); } return new ArrayList<>(setOfValues); @@ -62,4 +61,20 @@ public static double[][] toInput2dArray(List, String>> data) { return input2dArray; } + public static double[][] toInput2dArray(PredictionSet data) { + double[][] input2dArray = new double[data.getPredictionCount()][]; + final List predictionList = data.getPredictionList(); + for (int i = 0; i < predictionList.size(); i++) { + final Prediction prediction = predictionList.get(i); + final List row = prediction.getDataList(); + final double[] doubleRow = new double[row.size()]; + for (int j = 0; j < row.size(); j++) { + doubleRow[j] = row.get(j).getValue(); + } + input2dArray[i] = doubleRow; + } + + return input2dArray; + } + } diff --git a/src/main/java/tech/donau/behaiv/proto/Behaiv.java b/src/main/java/tech/donau/behaiv/proto/Behaiv.java index 7c5bde9..7b718d0 100644 --- a/src/main/java/tech/donau/behaiv/proto/Behaiv.java +++ b/src/main/java/tech/donau/behaiv/proto/Behaiv.java @@ -54,17 +54,18 @@ public static void registerAllExtensions( static { java.lang.String[] descriptorData = { "\n\014behaiv.proto\"(\n\004Data\022\013\n\003key\030\002 \001(\t\022\r\n\005v" + - "alue\030\003 \001(\001J\004\010\001\020\002\"5\n\nPrediction\022\023\n\004data\030\001" + - " \003(\0132\005.Data\022\022\n\nprediction\030\002 \001(\t\"0\n\rPredi" + - "ctionSet\022\037\n\nprediction\030\001 \003(\0132\013.Predictio" + - "n\"\342\001\n\006Action\022\020\n\010local_id\030\001 \001(\003\022\025\n\rprev_l" + - "ocal_id\030\002 \001(\003\022\016\n\006action\030\003 \001(\t\022\016\n\006object\030" + - "\004 \001(\t\022\031\n\021current_screen_id\030\005 \001(\005\022\024\n\014scre" + - "en_stack\030\006 \003(\005\022+\n\nattributes\030\010 \003(\0132\027.Act" + - "ion.AttributesEntry\0321\n\017AttributesEntry\022\013" + - "\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\"\n\006Screen" + - "\022\n\n\002id\030\001 \001(\005\022\014\n\004name\030\002 \001(\tB\033\n\027tech.donau" + - ".behaiv.protoP\001b\006proto3" + "alue\030\003 \001(\001J\004\010\001\020\002\"0\n\nPrediction\022\023\n\004data\030\001" + + " \003(\0132\005.Data\022\r\n\005label\030\002 \001(\t\"H\n\rPrediction" + + "Set\022\037\n\nprediction\030\001 \003(\0132\013.Prediction\022\026\n\016" + + "dynamicColumns\030\002 \001(\010\"\342\001\n\006Action\022\020\n\010local" + + "_id\030\001 \001(\003\022\025\n\rprev_local_id\030\002 \001(\003\022\016\n\006acti" + + "on\030\003 \001(\t\022\016\n\006object\030\004 \001(\t\022\031\n\021current_scre" + + "en_id\030\005 \001(\005\022\024\n\014screen_stack\030\006 \003(\005\022+\n\natt" + + "ributes\030\010 \003(\0132\027.Action.AttributesEntry\0321" + + "\n\017AttributesEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030" + + "\002 \001(\t:\0028\001\"\"\n\006Screen\022\n\n\002id\030\001 \001(\005\022\014\n\004name\030" + + "\002 \001(\tB\033\n\027tech.donau.behaiv.protoP\001b\006prot" + + "o3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -81,13 +82,13 @@ public static void registerAllExtensions( internal_static_Prediction_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_Prediction_descriptor, - new java.lang.String[] { "Data", "Prediction", }); + new java.lang.String[] { "Data", "Label", }); internal_static_PredictionSet_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_PredictionSet_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_PredictionSet_descriptor, - new java.lang.String[] { "Prediction", }); + new java.lang.String[] { "Prediction", "DynamicColumns", }); internal_static_Action_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_Action_fieldAccessorTable = new diff --git a/src/main/java/tech/donau/behaiv/proto/Prediction.java b/src/main/java/tech/donau/behaiv/proto/Prediction.java index a257ce7..c7188c3 100644 --- a/src/main/java/tech/donau/behaiv/proto/Prediction.java +++ b/src/main/java/tech/donau/behaiv/proto/Prediction.java @@ -17,7 +17,7 @@ private Prediction(com.google.protobuf.GeneratedMessageV3.Builder builder) { } private Prediction() { data_ = java.util.Collections.emptyList(); - prediction_ = ""; + label_ = ""; } @java.lang.Override @@ -63,7 +63,7 @@ private Prediction( case 18: { java.lang.String s = input.readStringRequireUtf8(); - prediction_ = s; + label_ = s; break; } default: { @@ -136,36 +136,36 @@ public tech.donau.behaiv.proto.DataOrBuilder getDataOrBuilder( return data_.get(index); } - public static final int PREDICTION_FIELD_NUMBER = 2; - private volatile java.lang.Object prediction_; + public static final int LABEL_FIELD_NUMBER = 2; + private volatile java.lang.Object label_; /** - * string prediction = 2; - * @return The prediction. + * string label = 2; + * @return The label. */ - public java.lang.String getPrediction() { - java.lang.Object ref = prediction_; + public java.lang.String getLabel() { + java.lang.Object ref = label_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); - prediction_ = s; + label_ = s; return s; } } /** - * string prediction = 2; - * @return The bytes for prediction. + * string label = 2; + * @return The bytes for label. */ public com.google.protobuf.ByteString - getPredictionBytes() { - java.lang.Object ref = prediction_; + getLabelBytes() { + java.lang.Object ref = label_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); - prediction_ = b; + label_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; @@ -189,8 +189,8 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) for (int i = 0; i < data_.size(); i++) { output.writeMessage(1, data_.get(i)); } - if (!getPredictionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, prediction_); + if (!getLabelBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, label_); } unknownFields.writeTo(output); } @@ -205,8 +205,8 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, data_.get(i)); } - if (!getPredictionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, prediction_); + if (!getLabelBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, label_); } size += unknownFields.getSerializedSize(); memoizedSize = size; @@ -225,8 +225,8 @@ public boolean equals(final java.lang.Object obj) { if (!getDataList() .equals(other.getDataList())) return false; - if (!getPrediction() - .equals(other.getPrediction())) return false; + if (!getLabel() + .equals(other.getLabel())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -242,8 +242,8 @@ public int hashCode() { hash = (37 * hash) + DATA_FIELD_NUMBER; hash = (53 * hash) + getDataList().hashCode(); } - hash = (37 * hash) + PREDICTION_FIELD_NUMBER; - hash = (53 * hash) + getPrediction().hashCode(); + hash = (37 * hash) + LABEL_FIELD_NUMBER; + hash = (53 * hash) + getLabel().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -384,7 +384,7 @@ public Builder clear() { } else { dataBuilder_.clear(); } - prediction_ = ""; + label_ = ""; return this; } @@ -422,7 +422,7 @@ public tech.donau.behaiv.proto.Prediction buildPartial() { } else { result.data_ = dataBuilder_.build(); } - result.prediction_ = prediction_; + result.label_ = label_; onBuilt(); return result; } @@ -497,8 +497,8 @@ public Builder mergeFrom(tech.donau.behaiv.proto.Prediction other) { } } } - if (!other.getPrediction().isEmpty()) { - prediction_ = other.prediction_; + if (!other.getLabel().isEmpty()) { + label_ = other.label_; onChanged(); } this.mergeUnknownFields(other.unknownFields); @@ -771,78 +771,78 @@ public tech.donau.behaiv.proto.Data.Builder addDataBuilder( return dataBuilder_; } - private java.lang.Object prediction_ = ""; + private java.lang.Object label_ = ""; /** - * string prediction = 2; - * @return The prediction. + * string label = 2; + * @return The label. */ - public java.lang.String getPrediction() { - java.lang.Object ref = prediction_; + public java.lang.String getLabel() { + java.lang.Object ref = label_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); - prediction_ = s; + label_ = s; return s; } else { return (java.lang.String) ref; } } /** - * string prediction = 2; - * @return The bytes for prediction. + * string label = 2; + * @return The bytes for label. */ public com.google.protobuf.ByteString - getPredictionBytes() { - java.lang.Object ref = prediction_; + getLabelBytes() { + java.lang.Object ref = label_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); - prediction_ = b; + label_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** - * string prediction = 2; - * @param value The prediction to set. + * string label = 2; + * @param value The label to set. * @return This builder for chaining. */ - public Builder setPrediction( + public Builder setLabel( java.lang.String value) { if (value == null) { throw new NullPointerException(); } - prediction_ = value; + label_ = value; onChanged(); return this; } /** - * string prediction = 2; + * string label = 2; * @return This builder for chaining. */ - public Builder clearPrediction() { + public Builder clearLabel() { - prediction_ = getDefaultInstance().getPrediction(); + label_ = getDefaultInstance().getLabel(); onChanged(); return this; } /** - * string prediction = 2; - * @param value The bytes for prediction to set. + * string label = 2; + * @param value The bytes for label to set. * @return This builder for chaining. */ - public Builder setPredictionBytes( + public Builder setLabelBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - prediction_ = value; + label_ = value; onChanged(); return this; } diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java index db9546a..740e6ae 100644 --- a/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java +++ b/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java @@ -32,14 +32,14 @@ tech.donau.behaiv.proto.DataOrBuilder getDataOrBuilder( int index); /** - * string prediction = 2; - * @return The prediction. + * string label = 2; + * @return The label. */ - java.lang.String getPrediction(); + java.lang.String getLabel(); /** - * string prediction = 2; - * @return The bytes for prediction. + * string label = 2; + * @return The bytes for label. */ com.google.protobuf.ByteString - getPredictionBytes(); + getLabelBytes(); } diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionSet.java b/src/main/java/tech/donau/behaiv/proto/PredictionSet.java index bc2fb05..6e11bf1 100644 --- a/src/main/java/tech/donau/behaiv/proto/PredictionSet.java +++ b/src/main/java/tech/donau/behaiv/proto/PredictionSet.java @@ -59,6 +59,11 @@ private PredictionSet( input.readMessage(tech.donau.behaiv.proto.Prediction.parser(), extensionRegistry)); break; } + case 16: { + + dynamicColumns_ = input.readBool(); + break; + } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { @@ -129,6 +134,16 @@ public tech.donau.behaiv.proto.PredictionOrBuilder getPredictionOrBuilder( return prediction_.get(index); } + public static final int DYNAMICCOLUMNS_FIELD_NUMBER = 2; + private boolean dynamicColumns_; + /** + * bool dynamicColumns = 2; + * @return The dynamicColumns. + */ + public boolean getDynamicColumns() { + return dynamicColumns_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -146,6 +161,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) for (int i = 0; i < prediction_.size(); i++) { output.writeMessage(1, prediction_.get(i)); } + if (dynamicColumns_ != false) { + output.writeBool(2, dynamicColumns_); + } unknownFields.writeTo(output); } @@ -159,6 +177,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, prediction_.get(i)); } + if (dynamicColumns_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(2, dynamicColumns_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -176,6 +198,8 @@ public boolean equals(final java.lang.Object obj) { if (!getPredictionList() .equals(other.getPredictionList())) return false; + if (getDynamicColumns() + != other.getDynamicColumns()) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -191,6 +215,9 @@ public int hashCode() { hash = (37 * hash) + PREDICTION_FIELD_NUMBER; hash = (53 * hash) + getPredictionList().hashCode(); } + hash = (37 * hash) + DYNAMICCOLUMNS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getDynamicColumns()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -331,6 +358,8 @@ public Builder clear() { } else { predictionBuilder_.clear(); } + dynamicColumns_ = false; + return this; } @@ -367,6 +396,7 @@ public tech.donau.behaiv.proto.PredictionSet buildPartial() { } else { result.prediction_ = predictionBuilder_.build(); } + result.dynamicColumns_ = dynamicColumns_; onBuilt(); return result; } @@ -441,6 +471,9 @@ public Builder mergeFrom(tech.donau.behaiv.proto.PredictionSet other) { } } } + if (other.getDynamicColumns() != false) { + setDynamicColumns(other.getDynamicColumns()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -710,6 +743,36 @@ public tech.donau.behaiv.proto.Prediction.Builder addPredictionBuilder( } return predictionBuilder_; } + + private boolean dynamicColumns_ ; + /** + * bool dynamicColumns = 2; + * @return The dynamicColumns. + */ + public boolean getDynamicColumns() { + return dynamicColumns_; + } + /** + * bool dynamicColumns = 2; + * @param value The dynamicColumns to set. + * @return This builder for chaining. + */ + public Builder setDynamicColumns(boolean value) { + + dynamicColumns_ = value; + onChanged(); + return this; + } + /** + * bool dynamicColumns = 2; + * @return This builder for chaining. + */ + public Builder clearDynamicColumns() { + + dynamicColumns_ = false; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java index 8252e1d..745e30e 100644 --- a/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java +++ b/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java @@ -30,4 +30,10 @@ public interface PredictionSetOrBuilder extends */ tech.donau.behaiv.proto.PredictionOrBuilder getPredictionOrBuilder( int index); + + /** + * bool dynamicColumns = 2; + * @return The dynamicColumns. + */ + boolean getDynamicColumns(); } diff --git a/src/test/java/de/dmi3y/behaiv/kernel/KernelTest.java b/src/test/java/de/dmi3y/behaiv/kernel/KernelTest.java index 78cde5f..cf1d1bd 100644 --- a/src/test/java/de/dmi3y/behaiv/kernel/KernelTest.java +++ b/src/test/java/de/dmi3y/behaiv/kernel/KernelTest.java @@ -6,6 +6,8 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import tech.donau.behaiv.proto.Data; +import tech.donau.behaiv.proto.Prediction; import java.io.File; import java.io.IOException; @@ -40,8 +42,12 @@ public void setUp() throws Exception { @Test public void setTreshold() { dummyKernel.setTreshold(1L); - dummyKernel.data.add(new Pair, String>(null, null)); - dummyKernel.data.add(new Pair, String>(null, null)); + final Prediction prediction = Prediction.newBuilder().addData( + Data.newBuilder().setKey("null").setValue(0.0D).build() + ).addData( + Data.newBuilder().setKey("null2").setValue(0.0D).build()).build(); + dummyKernel.data = dummyKernel.data.toBuilder() + .addPrediction(prediction).addPrediction(prediction).build(); boolean readyToPredict = dummyKernel.readyToPredict(); assertTrue(readyToPredict); dummyKernel.setTreshold(10L); diff --git a/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java b/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java index 1a6fdf4..bc6bef2 100644 --- a/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java +++ b/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java @@ -1,6 +1,7 @@ package de.dmi3y.behaiv.kernel; import de.dmi3y.behaiv.storage.SimpleStorage; +import de.dmi3y.behaiv.tools.DataMappingUtils; import de.dmi3y.behaiv.tools.Pair; import org.junit.Before; import org.junit.Rule; @@ -15,7 +16,6 @@ import static de.dmi3y.behaiv.kernel.KernelTest.HOME; import static de.dmi3y.behaiv.kernel.KernelTest.WORK; -import static de.dmi3y.behaiv.kernel.KernelTest.getTrainingData; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -145,8 +145,8 @@ public void storeResults_saveWhenDataIsNull_expectException() throws IOException public void storeResults_saveDataAndThenTheta_expectNormalFlow() throws IOException, ClassNotFoundException { List, String>> data = KernelTest.getTrainingData(); LogisticRegressionKernel kernel = new LogisticRegressionKernel("storeTest", new Random()); - kernel.data = data; - kernel.labels = Arrays.asList("time", "lat", "lon", "headphones"); + kernel.data = DataMappingUtils.createPredictionSet(data); + kernel.cachedLables = Arrays.asList("time", "lat", "lon", "headphones"); //Omit fit // kernel.fit(data); ArrayList predictList = new ArrayList<>(); @@ -161,8 +161,7 @@ public void storeResults_saveDataAndThenTheta_expectNormalFlow() throws IOExcept kernel = new LogisticRegressionKernel("storeTest"); kernel.restore(storage); - assertFalse(kernel.data.isEmpty()); - kernel.data.get(0).getKey(); + assertFalse(kernel.data.getPredictionList().isEmpty()); kernel.fit(data); String prediction = kernel.predictOne(predictList); diff --git a/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java b/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java index f9f5f50..3468804 100644 --- a/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java +++ b/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java @@ -1,7 +1,6 @@ package de.dmi3y.behaiv.tools; import org.junit.Test; -import org.mockito.internal.matchers.Null; import tech.donau.behaiv.proto.Prediction; import tech.donau.behaiv.proto.PredictionSet; @@ -10,8 +9,12 @@ import java.util.Collections; import java.util.List; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.hasItem; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; public class DataMappingUtilsTest { @@ -22,7 +25,7 @@ public void createPredictionSet_feedDefaultTestData_expectCorrectOrder() { final PredictionSet predictionSet = DataMappingUtils.createPredictionSet(Collections.singletonList(mockData)); assertEquals(1, predictionSet.getPredictionCount()); final Prediction prediction = predictionSet.getPrediction(0); - assertEquals("Potato", prediction.getPrediction()); + assertEquals("Potato", prediction.getLabel()); assertEquals(1, prediction.getDataCount()); assertEquals("key0", prediction.getData(0).getKey()); assertEquals(20d, prediction.getData(0).getValue(), 0); @@ -88,7 +91,7 @@ public void toInput2dArray_withEmptyListOfInputData_returnsEmpty2dArray() { @Test(expected = NullPointerException.class) public void toInput2dArray_withNull_throwsNullPointerException() { - DataMappingUtils.toInput2dArray(null); + DataMappingUtils.toInput2dArray((List, String>>) null); } From 65b24f3356f867c1629842517536f3a3ca54d233 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 19:53:29 +0100 Subject: [PATCH 07/23] Ignore tech.donau.behaiv.proto package on jacoco reports --- build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index cec6e41..1ccdb32 100644 --- a/build.gradle +++ b/build.gradle @@ -80,6 +80,11 @@ jacocoTestReport { xml.enabled = true csv.enabled = false } + afterEvaluate { + classDirectories.setFrom(files(classDirectories.files.collect { + fileTree(dir: it, exclude: 'tech/donau/behaiv/proto**') + })) + } } task proto(type: Exec) { From a90946394b6f301ce34f44866bedc0621351fac5 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 19:57:15 +0100 Subject: [PATCH 08/23] Removed unused empty constructor in Pair.java --- src/main/java/de/dmi3y/behaiv/tools/Pair.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/de/dmi3y/behaiv/tools/Pair.java b/src/main/java/de/dmi3y/behaiv/tools/Pair.java index da0fe93..9cd9b98 100644 --- a/src/main/java/de/dmi3y/behaiv/tools/Pair.java +++ b/src/main/java/de/dmi3y/behaiv/tools/Pair.java @@ -14,9 +14,6 @@ public Pair(de.dmi3y.behaiv.tools.Pair entry) { this(entry.getKey(), entry.getValue()); } - public Pair() { - } - public K getKey() { return this.key; } From 2eea223471a2afdad0c6f9e1b439c520258f81f3 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 20:03:36 +0100 Subject: [PATCH 09/23] added test for LogisticRegressionKernel to check if partial fit is allowed --- .../dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java b/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java index bc6bef2..2157575 100644 --- a/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java +++ b/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java @@ -57,6 +57,12 @@ public void predictOne() { assertEquals("SELFIMPROVEMENT_SCREEN", prediction); } + @Test + public void isPartialFitAllowed_inLogisticRegression_shouldReturnFalse() { + final Kernel kernel = new LogisticRegressionKernel("testId"); + assertFalse(kernel.isPartialFitAllowed()); + } + @Test public void storeResults() throws IOException, ClassNotFoundException { List, String>> data = KernelTest.getTrainingData(); From d4632317e2e69f4199fc50ce772d1fe3b047fdcd Mon Sep 17 00:00:00 2001 From: Dmitriy Chaban Date: Sat, 4 Apr 2020 12:19:40 +0300 Subject: [PATCH 10/23] Revert "Feature/convert to proto" --- build.gradle | 5 - .../de/dmi3y/behaiv/kernel/BaseKernel.java | 97 -- .../java/de/dmi3y/behaiv/kernel/Kernel.java | 90 +- .../kernel/LogisticRegressionKernel.java | 87 +- .../dmi3y/behaiv/tools/DataMappingUtils.java | 41 +- src/main/java/de/dmi3y/behaiv/tools/Pair.java | 3 + .../java/tech/donau/behaiv/proto/Action.java | 1379 ----------------- .../donau/behaiv/proto/ActionOrBuilder.java | 114 -- .../java/tech/donau/behaiv/proto/Behaiv.java | 113 -- .../java/tech/donau/behaiv/proto/Data.java | 627 -------- .../donau/behaiv/proto/DataOrBuilder.java | 27 - .../tech/donau/behaiv/proto/Prediction.java | 901 ----------- .../behaiv/proto/PredictionOrBuilder.java | 45 - .../donau/behaiv/proto/PredictionSet.java | 828 ---------- .../behaiv/proto/PredictionSetOrBuilder.java | 39 - .../java/tech/donau/behaiv/proto/Screen.java | 617 -------- .../donau/behaiv/proto/ScreenOrBuilder.java | 27 - src/test/java/de/dmi3y/behaiv/BehaivTest.java | 5 +- .../de/dmi3y/behaiv/kernel/KernelTest.java | 10 +- .../kernel/LogisticRegressionKernelTest.java | 15 +- .../behaiv/tools/DataMappingUtilsTest.java | 26 +- 21 files changed, 112 insertions(+), 4984 deletions(-) delete mode 100644 src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java delete mode 100644 src/main/java/tech/donau/behaiv/proto/Action.java delete mode 100644 src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java delete mode 100644 src/main/java/tech/donau/behaiv/proto/Behaiv.java delete mode 100644 src/main/java/tech/donau/behaiv/proto/Data.java delete mode 100644 src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java delete mode 100644 src/main/java/tech/donau/behaiv/proto/Prediction.java delete mode 100644 src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java delete mode 100644 src/main/java/tech/donau/behaiv/proto/PredictionSet.java delete mode 100644 src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java delete mode 100644 src/main/java/tech/donau/behaiv/proto/Screen.java delete mode 100644 src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java diff --git a/build.gradle b/build.gradle index 1ccdb32..cec6e41 100644 --- a/build.gradle +++ b/build.gradle @@ -80,11 +80,6 @@ jacocoTestReport { xml.enabled = true csv.enabled = false } - afterEvaluate { - classDirectories.setFrom(files(classDirectories.files.collect { - fileTree(dir: it, exclude: 'tech/donau/behaiv/proto**') - })) - } } task proto(type: Exec) { diff --git a/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java b/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java deleted file mode 100644 index e2a4bb5..0000000 --- a/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java +++ /dev/null @@ -1,97 +0,0 @@ -package de.dmi3y.behaiv.kernel; - -import com.fasterxml.jackson.databind.ObjectMapper; -import de.dmi3y.behaiv.storage.BehaivStorage; -import de.dmi3y.behaiv.tools.Pair; -import tech.donau.behaiv.proto.Data; -import tech.donau.behaiv.proto.Prediction; -import tech.donau.behaiv.proto.PredictionSet; - -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -public abstract class BaseKernel implements Kernel { - - protected String id; - protected Long treshold = 10L; - protected ObjectMapper objectMapper; - protected boolean partialFitAllowed = false; - protected boolean alwaysKeepData = true; - - public BaseKernel(String id) { - this.id = id; - objectMapper = new ObjectMapper(); - } - - - @Override - public void setId(String id) { - this.id = id; - } - - - //list, label - protected PredictionSet data = PredictionSet.newBuilder().addAllPrediction(new ArrayList()).build(); - - - @Override - public void fit() { - fit(this.data); - } - - @Override - public void setTreshold(Long treshold) { - this.treshold = treshold; - } - - @Override - public boolean readyToPredict() { - return data.getPredictionList().size() > treshold; - } - - @Override - public void update(List, String>> data) { - } - - @Override - public boolean isPartialFitAllowed() { - return partialFitAllowed; - } - - @Override - public void updateSingle(List features, String label) { - final Prediction.Builder predictionBuilder = Prediction.newBuilder(); - for (int i = 0; i < features.size(); i++) { - predictionBuilder.addData(Data.newBuilder().setKey("key" + i).setValue(features.get(i)).build()); - } - predictionBuilder.setLabel(label); - data = data.toBuilder().addPrediction(predictionBuilder.build()).build(); - } - - @Override - public boolean isAlwaysKeepData() { - return alwaysKeepData; - } - - @Override - public void setAlwaysKeepData(boolean alwaysKeepData) { - this.alwaysKeepData = alwaysKeepData; - } - - @Override - public void save(BehaivStorage storage) throws IOException { - try (final FileOutputStream writer = new FileOutputStream(storage.getDataFile(id))) { - data.writeTo(writer); - } - } - - @Override - public void restore(BehaivStorage storage) throws IOException { - try (final FileInputStream reader = new FileInputStream(storage.getDataFile(id))) { - data = PredictionSet.parseFrom(reader); - } - } -} diff --git a/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java b/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java index 8f915fa..ec414f5 100644 --- a/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java +++ b/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java @@ -1,41 +1,95 @@ package de.dmi3y.behaiv.kernel; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import de.dmi3y.behaiv.storage.BehaivStorage; import de.dmi3y.behaiv.tools.Pair; -import tech.donau.behaiv.proto.PredictionSet; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileReader; +import java.io.FileWriter; import java.io.IOException; +import java.util.ArrayList; import java.util.List; -public interface Kernel { - void setId(String id); +public abstract class Kernel { - boolean isEmpty(); + protected String id; + protected Long treshold = 10L; + protected ObjectMapper objectMapper; + protected boolean partialFitAllowed = false; + protected boolean alwaysKeepData = true; - @Deprecated - void fit(List, String>> data); + public Kernel(String id) { + this.id = id; + objectMapper = new ObjectMapper(); + } - void fit(PredictionSet data); - void fit(); + public void setId(String id) { + this.id = id; + } - void setTreshold(Long treshold); - boolean readyToPredict(); + //list, label + protected List, String>> data = new ArrayList<>(); - void update(List, String>> data); - boolean isPartialFitAllowed(); + public abstract boolean isEmpty(); - void updateSingle(List features, String label); + public abstract void fit(List, String>> data); - String predictOne(List features); + public void fit() { + fit(this.data); + } - boolean isAlwaysKeepData(); + public void setTreshold(Long treshold) { + this.treshold = treshold; + } - void setAlwaysKeepData(boolean alwaysKeepData); + public boolean readyToPredict() { + return data.size() > treshold; + } - void save(BehaivStorage storage) throws IOException; + public void update(List, String>> data) { + } - void restore(BehaivStorage storage) throws IOException; + public boolean isPartialFitAllowed() { + return partialFitAllowed; + } + + public void updateSingle(List features, String label) { + data.add(new Pair<>(features, label)); + } + + public abstract String predictOne(List features); + + public boolean isAlwaysKeepData() { + return alwaysKeepData; + } + + public void setAlwaysKeepData(boolean alwaysKeepData) { + this.alwaysKeepData = alwaysKeepData; + } + + public void save(BehaivStorage storage) throws IOException { + + try (final BufferedWriter writer = new BufferedWriter(new FileWriter(storage.getDataFile(id)))) { + writer.write(objectMapper.writeValueAsString(data)); + } + } + + public void restore(BehaivStorage storage) throws IOException { + final TypeReference, String>>> typeReference = new TypeReference, String>>>() { + }; + try (final BufferedReader reader = new BufferedReader(new FileReader(storage.getDataFile(id)))) { + final String content = reader.readLine(); + if (content == null || content.isEmpty()) { + data = new ArrayList<>(); + } else { + data = objectMapper.readValue(content, typeReference); + } + } + } } diff --git a/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java b/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java index f15a9e6..5205d25 100644 --- a/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java +++ b/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java @@ -3,27 +3,23 @@ import com.fasterxml.jackson.core.type.TypeReference; import de.dmi3y.behaiv.kernel.logistic.LogisticUtils; import de.dmi3y.behaiv.storage.BehaivStorage; -import de.dmi3y.behaiv.tools.DataMappingUtils; import de.dmi3y.behaiv.tools.Pair; import org.apache.commons.lang3.ArrayUtils; import org.ejml.simple.SimpleMatrix; -import tech.donau.behaiv.proto.PredictionSet; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; +import java.util.*; import static de.dmi3y.behaiv.tools.DataMappingUtils.toDistinctListOfPairValues; import static de.dmi3y.behaiv.tools.DataMappingUtils.toInput2dArray; -public class LogisticRegressionKernel extends BaseKernel { +public class LogisticRegressionKernel extends Kernel { - protected List cachedLables = new ArrayList<>(); + protected List labels = new ArrayList<>(); private Random rand; protected SimpleMatrix theta; @@ -39,64 +35,24 @@ public LogisticRegressionKernel(String id) { @Override public boolean isEmpty() { - return theta == null && data.getPredictionCount() == 0; + return theta == null && data.size() == 0; } + @Override - public void fit(PredictionSet data) { + public void fit(List, String>> data) { this.data = data; - if (data.getDynamicColumns()) { - throw new UnsupportedOperationException("LogisticRegressionKernel doesn't support dynamic fields"); - } - for (int i = 0; i < data.getPredictionList().size(); i++) { - cachedLables.add(data.getPredictionList().get(i).getLabel()); - } + labels = toDistinctListOfPairValues(data); if (readyToPredict()) { - //features - double[][] inputs = toInput2dArray(data); - - //labels - double[][] labelArray = new double[data.getPredictionCount()][cachedLables.size()]; - for (int i = 0; i < data.getPredictionCount(); i++) { - int dummyPos = cachedLables.indexOf(data.getPrediction(i).getLabel()); - labelArray[i][dummyPos] = 1.0; - } - - //output layer - final SimpleMatrix inputMatrix = new SimpleMatrix(inputs); - final SimpleMatrix outputMatrix = new SimpleMatrix(labelArray); - //3x4? - - //TODO dilemma on if we need to re-do theta or keep it as-is, if new features arrising we'll have a problem - if (theta == null || (theta.numCols() != cachedLables.size() && alwaysKeepData)) { - theta = SimpleMatrix.random_DDRM(inputMatrix.numCols(), outputMatrix.numCols(), 0, 1, rand); - } else if (theta.numCols() != cachedLables.size() && !alwaysKeepData) { - throw new UnsupportedOperationException( - "Partial fit of LogisticRegressionKernel is not supported. " + - "Number of labels differs from trained model." + - " Consider setting alwaysKeepData to true or changing Kernel that supports partial fit." - ); - } - - for (int i = 0; i < 10000; i++) { - theta = LogisticUtils.gradientDescent(inputMatrix, theta, outputMatrix, 0.1); - } - } - } - @Override - public void fit(List, String>> data) { - this.data = DataMappingUtils.createPredictionSet(data); - this.cachedLables = toDistinctListOfPairValues(data); - if (readyToPredict()) { //features double[][] inputs = toInput2dArray(data); //labels - double[][] labelArray = new double[data.size()][cachedLables.size()]; + double[][] labelArray = new double[data.size()][labels.size()]; for (int i = 0; i < data.size(); i++) { - int dummyPos = cachedLables.indexOf(data.get(i).getValue()); + int dummyPos = labels.indexOf(data.get(i).getValue()); labelArray[i][dummyPos] = 1.0; } @@ -106,9 +62,9 @@ public void fit(List, String>> data) { //3x4? //TODO dilemma on if we need to re-do theta or keep it as-is, if new features arrising we'll have a problem - if (theta == null || (theta.numCols() != cachedLables.size() && alwaysKeepData)) { + if (theta == null || (theta.numCols() != labels.size() && alwaysKeepData)) { theta = SimpleMatrix.random_DDRM(inputMatrix.numCols(), outputMatrix.numCols(), 0, 1, rand); - } else if (theta.numCols() != cachedLables.size() && !alwaysKeepData) { + } else if (theta.numCols() != labels.size() && !alwaysKeepData) { throw new UnsupportedOperationException( "Partial fit of LogisticRegressionKernel is not supported. " + "Number of labels differs from trained model." + @@ -136,6 +92,8 @@ public void updateSingle(List features, String label) { @Override public String predictOne(List features) { + + final double[] doubles = ArrayUtils.toPrimitive(features.toArray(new Double[0])); final SimpleMatrix inputs = new SimpleMatrix(new double[][]{doubles}); @@ -148,21 +106,18 @@ public String predictOne(List features) { maxPosition = i; } } - return cachedLables.get(maxPosition); + return labels.get(maxPosition); } @Override public void save(BehaivStorage storage) throws IOException { - if (theta == null && (data == null || data.getPredictionList().isEmpty())) { + if (theta == null && (data == null || data.isEmpty())) { throw new IOException("Not enough data to save, network data is empty"); } - if (cachedLables == null || cachedLables.isEmpty()) { - cachedLables = new ArrayList<>(); - for (int i = 0; i < data.getPredictionList().size(); i++) { - cachedLables.add(data.getPredictionList().get(i).getLabel()); - } + if(labels == null || labels.isEmpty()) { + labels = toDistinctListOfPairValues(data); } - if (cachedLables.isEmpty()) { + if (labels.isEmpty()) { String message; message = "Kernel collected data but failed to get labels, couldn't save network."; throw new IOException(message); @@ -176,7 +131,7 @@ public void save(BehaivStorage storage) throws IOException { theta.saveToFileBinary(storage.getNetworkFile(id).toString()); try (final BufferedWriter writer = new BufferedWriter(new FileWriter(storage.getNetworkMetadataFile(id)))) { - writer.write(objectMapper.writeValueAsString(cachedLables)); + writer.write(objectMapper.writeValueAsString(labels)); } catch (Exception e) { e.printStackTrace(); } @@ -202,9 +157,9 @@ public void restore(BehaivStorage storage) throws IOException { }; final String labelsData = reader.readLine(); if (labelsData == null) { - cachedLables = new ArrayList<>(); + labels = new ArrayList<>(); } else { - cachedLables = objectMapper.readValue(labelsData, typeReference); + labels = objectMapper.readValue(labelsData, typeReference); } } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java index 94cc1d7..a66f278 100644 --- a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java +++ b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java @@ -1,42 +1,23 @@ package de.dmi3y.behaiv.tools; import org.apache.commons.lang3.ArrayUtils; -import tech.donau.behaiv.proto.Data; -import tech.donau.behaiv.proto.Prediction; -import tech.donau.behaiv.proto.PredictionSet; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -public final class DataMappingUtils { +public final class DataMappingUtils +{ private DataMappingUtils() { // Unused utility class } - public static PredictionSet createPredictionSet(List, String>> data) { - final PredictionSet.Builder predictionSetBuilder = PredictionSet.newBuilder(); - for (int i = 0; i < data.size(); i++) { - final List weights = data.get(i).getKey(); - final ArrayList row = new ArrayList<>(); - for (int j = 0; j < weights.size(); j++) { - row.add(Data.newBuilder().setKey("key" + j).setValue(weights.get(j)).build()); - } - predictionSetBuilder.addPrediction( - Prediction.newBuilder() - .addAllData(row) - .setLabel(data.get(i).getValue()) - .build() - ); - } - return predictionSetBuilder.buildPartial(); - } public static List toDistinctListOfPairValues(List, String>> data) { Set setOfValues = new HashSet<>(); - for (Pair, String> arrayListStringPair : data) { + for(Pair, String> arrayListStringPair : data ) { setOfValues.add(arrayListStringPair.getValue()); } return new ArrayList<>(setOfValues); @@ -61,20 +42,4 @@ public static double[][] toInput2dArray(List, String>> data) { return input2dArray; } - public static double[][] toInput2dArray(PredictionSet data) { - double[][] input2dArray = new double[data.getPredictionCount()][]; - final List predictionList = data.getPredictionList(); - for (int i = 0; i < predictionList.size(); i++) { - final Prediction prediction = predictionList.get(i); - final List row = prediction.getDataList(); - final double[] doubleRow = new double[row.size()]; - for (int j = 0; j < row.size(); j++) { - doubleRow[j] = row.get(j).getValue(); - } - input2dArray[i] = doubleRow; - } - - return input2dArray; - } - } diff --git a/src/main/java/de/dmi3y/behaiv/tools/Pair.java b/src/main/java/de/dmi3y/behaiv/tools/Pair.java index 9cd9b98..da0fe93 100644 --- a/src/main/java/de/dmi3y/behaiv/tools/Pair.java +++ b/src/main/java/de/dmi3y/behaiv/tools/Pair.java @@ -14,6 +14,9 @@ public Pair(de.dmi3y.behaiv.tools.Pair entry) { this(entry.getKey(), entry.getValue()); } + public Pair() { + } + public K getKey() { return this.key; } diff --git a/src/main/java/tech/donau/behaiv/proto/Action.java b/src/main/java/tech/donau/behaiv/proto/Action.java deleted file mode 100644 index 942d4f8..0000000 --- a/src/main/java/tech/donau/behaiv/proto/Action.java +++ /dev/null @@ -1,1379 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: behaiv.proto - -package tech.donau.behaiv.proto; - -/** - *
- * Communication messages
- * 
- * - * Protobuf type {@code Action} - */ -public final class Action extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Action) - ActionOrBuilder { -private static final long serialVersionUID = 0L; - // Use Action.newBuilder() to construct. - private Action(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Action() { - action_ = ""; - object_ = ""; - screenStack_ = emptyIntList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new Action(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Action( - 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; - case 8: { - - localId_ = input.readInt64(); - break; - } - case 16: { - - prevLocalId_ = input.readInt64(); - break; - } - case 26: { - java.lang.String s = input.readStringRequireUtf8(); - - action_ = s; - break; - } - case 34: { - java.lang.String s = input.readStringRequireUtf8(); - - object_ = s; - break; - } - case 40: { - - currentScreenId_ = input.readInt32(); - break; - } - case 48: { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - screenStack_ = newIntList(); - mutable_bitField0_ |= 0x00000001; - } - screenStack_.addInt(input.readInt32()); - break; - } - case 50: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) { - screenStack_ = newIntList(); - mutable_bitField0_ |= 0x00000001; - } - while (input.getBytesUntilLimit() > 0) { - screenStack_.addInt(input.readInt32()); - } - input.popLimit(limit); - break; - } - case 66: { - if (!((mutable_bitField0_ & 0x00000002) != 0)) { - attributes_ = com.google.protobuf.MapField.newMapField( - AttributesDefaultEntryHolder.defaultEntry); - mutable_bitField0_ |= 0x00000002; - } - com.google.protobuf.MapEntry - attributes__ = input.readMessage( - AttributesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); - attributes_.getMutableMap().put( - attributes__.getKey(), attributes__.getValue()); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - 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) != 0)) { - screenStack_.makeImmutable(); // C - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Action_descriptor; - } - - @SuppressWarnings({"rawtypes"}) - @java.lang.Override - protected com.google.protobuf.MapField internalGetMapField( - int number) { - switch (number) { - case 8: - return internalGetAttributes(); - default: - throw new RuntimeException( - "Invalid map field number: " + number); - } - } - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Action_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tech.donau.behaiv.proto.Action.class, tech.donau.behaiv.proto.Action.Builder.class); - } - - public static final int LOCAL_ID_FIELD_NUMBER = 1; - private long localId_; - /** - * int64 local_id = 1; - * @return The localId. - */ - public long getLocalId() { - return localId_; - } - - public static final int PREV_LOCAL_ID_FIELD_NUMBER = 2; - private long prevLocalId_; - /** - * int64 prev_local_id = 2; - * @return The prevLocalId. - */ - public long getPrevLocalId() { - return prevLocalId_; - } - - public static final int ACTION_FIELD_NUMBER = 3; - private volatile java.lang.Object action_; - /** - * string action = 3; - * @return The action. - */ - public java.lang.String getAction() { - java.lang.Object ref = action_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - action_ = s; - return s; - } - } - /** - * string action = 3; - * @return The bytes for action. - */ - public com.google.protobuf.ByteString - getActionBytes() { - java.lang.Object ref = action_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - action_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int OBJECT_FIELD_NUMBER = 4; - private volatile java.lang.Object object_; - /** - * string object = 4; - * @return The object. - */ - public java.lang.String getObject() { - java.lang.Object ref = object_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - object_ = s; - return s; - } - } - /** - * string object = 4; - * @return The bytes for object. - */ - public com.google.protobuf.ByteString - getObjectBytes() { - java.lang.Object ref = object_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - object_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int CURRENT_SCREEN_ID_FIELD_NUMBER = 5; - private int currentScreenId_; - /** - * int32 current_screen_id = 5; - * @return The currentScreenId. - */ - public int getCurrentScreenId() { - return currentScreenId_; - } - - public static final int SCREEN_STACK_FIELD_NUMBER = 6; - private com.google.protobuf.Internal.IntList screenStack_; - /** - *
-   *    repeated Event events = 7; TODO
-   * 
- * - * repeated int32 screen_stack = 6; - * @return A list containing the screenStack. - */ - public java.util.List - getScreenStackList() { - return screenStack_; - } - /** - *
-   *    repeated Event events = 7; TODO
-   * 
- * - * repeated int32 screen_stack = 6; - * @return The count of screenStack. - */ - public int getScreenStackCount() { - return screenStack_.size(); - } - /** - *
-   *    repeated Event events = 7; TODO
-   * 
- * - * repeated int32 screen_stack = 6; - * @param index The index of the element to return. - * @return The screenStack at the given index. - */ - public int getScreenStack(int index) { - return screenStack_.getInt(index); - } - private int screenStackMemoizedSerializedSize = -1; - - public static final int ATTRIBUTES_FIELD_NUMBER = 8; - private static final class AttributesDefaultEntryHolder { - static final com.google.protobuf.MapEntry< - java.lang.String, java.lang.String> defaultEntry = - com.google.protobuf.MapEntry - .newDefaultInstance( - tech.donau.behaiv.proto.Behaiv.internal_static_Action_AttributesEntry_descriptor, - com.google.protobuf.WireFormat.FieldType.STRING, - "", - com.google.protobuf.WireFormat.FieldType.STRING, - ""); - } - private com.google.protobuf.MapField< - java.lang.String, java.lang.String> attributes_; - private com.google.protobuf.MapField - internalGetAttributes() { - if (attributes_ == null) { - return com.google.protobuf.MapField.emptyMapField( - AttributesDefaultEntryHolder.defaultEntry); - } - return attributes_; - } - - public int getAttributesCount() { - return internalGetAttributes().getMap().size(); - } - /** - * map<string, string> attributes = 8; - */ - - public boolean containsAttributes( - java.lang.String key) { - if (key == null) { throw new java.lang.NullPointerException(); } - return internalGetAttributes().getMap().containsKey(key); - } - /** - * Use {@link #getAttributesMap()} instead. - */ - @java.lang.Deprecated - public java.util.Map getAttributes() { - return getAttributesMap(); - } - /** - * map<string, string> attributes = 8; - */ - - public java.util.Map getAttributesMap() { - return internalGetAttributes().getMap(); - } - /** - * map<string, string> attributes = 8; - */ - - public java.lang.String getAttributesOrDefault( - java.lang.String key, - java.lang.String defaultValue) { - if (key == null) { throw new java.lang.NullPointerException(); } - java.util.Map map = - internalGetAttributes().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; - } - /** - * map<string, string> attributes = 8; - */ - - public java.lang.String getAttributesOrThrow( - java.lang.String key) { - if (key == null) { throw new java.lang.NullPointerException(); } - java.util.Map map = - internalGetAttributes().getMap(); - if (!map.containsKey(key)) { - throw new java.lang.IllegalArgumentException(); - } - return map.get(key); - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (localId_ != 0L) { - output.writeInt64(1, localId_); - } - if (prevLocalId_ != 0L) { - output.writeInt64(2, prevLocalId_); - } - if (!getActionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, action_); - } - if (!getObjectBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 4, object_); - } - if (currentScreenId_ != 0) { - output.writeInt32(5, currentScreenId_); - } - if (getScreenStackList().size() > 0) { - output.writeUInt32NoTag(50); - output.writeUInt32NoTag(screenStackMemoizedSerializedSize); - } - for (int i = 0; i < screenStack_.size(); i++) { - output.writeInt32NoTag(screenStack_.getInt(i)); - } - com.google.protobuf.GeneratedMessageV3 - .serializeStringMapTo( - output, - internalGetAttributes(), - AttributesDefaultEntryHolder.defaultEntry, - 8); - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (localId_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, localId_); - } - if (prevLocalId_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, prevLocalId_); - } - if (!getActionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, action_); - } - if (!getObjectBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, object_); - } - if (currentScreenId_ != 0) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(5, currentScreenId_); - } - { - int dataSize = 0; - for (int i = 0; i < screenStack_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(screenStack_.getInt(i)); - } - size += dataSize; - if (!getScreenStackList().isEmpty()) { - size += 1; - size += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(dataSize); - } - screenStackMemoizedSerializedSize = dataSize; - } - for (java.util.Map.Entry entry - : internalGetAttributes().getMap().entrySet()) { - com.google.protobuf.MapEntry - attributes__ = AttributesDefaultEntryHolder.defaultEntry.newBuilderForType() - .setKey(entry.getKey()) - .setValue(entry.getValue()) - .build(); - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(8, attributes__); - } - 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 tech.donau.behaiv.proto.Action)) { - return super.equals(obj); - } - tech.donau.behaiv.proto.Action other = (tech.donau.behaiv.proto.Action) obj; - - if (getLocalId() - != other.getLocalId()) return false; - if (getPrevLocalId() - != other.getPrevLocalId()) return false; - if (!getAction() - .equals(other.getAction())) return false; - if (!getObject() - .equals(other.getObject())) return false; - if (getCurrentScreenId() - != other.getCurrentScreenId()) return false; - if (!getScreenStackList() - .equals(other.getScreenStackList())) return false; - if (!internalGetAttributes().equals( - other.internalGetAttributes())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + LOCAL_ID_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getLocalId()); - hash = (37 * hash) + PREV_LOCAL_ID_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getPrevLocalId()); - hash = (37 * hash) + ACTION_FIELD_NUMBER; - hash = (53 * hash) + getAction().hashCode(); - hash = (37 * hash) + OBJECT_FIELD_NUMBER; - hash = (53 * hash) + getObject().hashCode(); - hash = (37 * hash) + CURRENT_SCREEN_ID_FIELD_NUMBER; - hash = (53 * hash) + getCurrentScreenId(); - if (getScreenStackCount() > 0) { - hash = (37 * hash) + SCREEN_STACK_FIELD_NUMBER; - hash = (53 * hash) + getScreenStackList().hashCode(); - } - if (!internalGetAttributes().getMap().isEmpty()) { - hash = (37 * hash) + ATTRIBUTES_FIELD_NUMBER; - hash = (53 * hash) + internalGetAttributes().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static tech.donau.behaiv.proto.Action parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Action parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Action parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Action parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Action parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Action parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Action parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Action 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 tech.donau.behaiv.proto.Action parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Action 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 tech.donau.behaiv.proto.Action parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Action parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(tech.donau.behaiv.proto.Action prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - 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; - } - /** - *
-   * Communication messages
-   * 
- * - * Protobuf type {@code Action} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Action) - tech.donau.behaiv.proto.ActionOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Action_descriptor; - } - - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMapField( - int number) { - switch (number) { - case 8: - return internalGetAttributes(); - default: - throw new RuntimeException( - "Invalid map field number: " + number); - } - } - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMutableMapField( - int number) { - switch (number) { - case 8: - return internalGetMutableAttributes(); - default: - throw new RuntimeException( - "Invalid map field number: " + number); - } - } - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Action_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tech.donau.behaiv.proto.Action.class, tech.donau.behaiv.proto.Action.Builder.class); - } - - // Construct using tech.donau.behaiv.proto.Action.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - @java.lang.Override - public Builder clear() { - super.clear(); - localId_ = 0L; - - prevLocalId_ = 0L; - - action_ = ""; - - object_ = ""; - - currentScreenId_ = 0; - - screenStack_ = emptyIntList(); - bitField0_ = (bitField0_ & ~0x00000001); - internalGetMutableAttributes().clear(); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Action_descriptor; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Action getDefaultInstanceForType() { - return tech.donau.behaiv.proto.Action.getDefaultInstance(); - } - - @java.lang.Override - public tech.donau.behaiv.proto.Action build() { - tech.donau.behaiv.proto.Action result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Action buildPartial() { - tech.donau.behaiv.proto.Action result = new tech.donau.behaiv.proto.Action(this); - int from_bitField0_ = bitField0_; - result.localId_ = localId_; - result.prevLocalId_ = prevLocalId_; - result.action_ = action_; - result.object_ = object_; - result.currentScreenId_ = currentScreenId_; - if (((bitField0_ & 0x00000001) != 0)) { - screenStack_.makeImmutable(); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.screenStack_ = screenStack_; - result.attributes_ = internalGetAttributes(); - result.attributes_.makeImmutable(); - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof tech.donau.behaiv.proto.Action) { - return mergeFrom((tech.donau.behaiv.proto.Action)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(tech.donau.behaiv.proto.Action other) { - if (other == tech.donau.behaiv.proto.Action.getDefaultInstance()) return this; - if (other.getLocalId() != 0L) { - setLocalId(other.getLocalId()); - } - if (other.getPrevLocalId() != 0L) { - setPrevLocalId(other.getPrevLocalId()); - } - if (!other.getAction().isEmpty()) { - action_ = other.action_; - onChanged(); - } - if (!other.getObject().isEmpty()) { - object_ = other.object_; - onChanged(); - } - if (other.getCurrentScreenId() != 0) { - setCurrentScreenId(other.getCurrentScreenId()); - } - if (!other.screenStack_.isEmpty()) { - if (screenStack_.isEmpty()) { - screenStack_ = other.screenStack_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureScreenStackIsMutable(); - screenStack_.addAll(other.screenStack_); - } - onChanged(); - } - internalGetMutableAttributes().mergeFrom( - other.internalGetAttributes()); - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - tech.donau.behaiv.proto.Action parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (tech.donau.behaiv.proto.Action) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private long localId_ ; - /** - * int64 local_id = 1; - * @return The localId. - */ - public long getLocalId() { - return localId_; - } - /** - * int64 local_id = 1; - * @param value The localId to set. - * @return This builder for chaining. - */ - public Builder setLocalId(long value) { - - localId_ = value; - onChanged(); - return this; - } - /** - * int64 local_id = 1; - * @return This builder for chaining. - */ - public Builder clearLocalId() { - - localId_ = 0L; - onChanged(); - return this; - } - - private long prevLocalId_ ; - /** - * int64 prev_local_id = 2; - * @return The prevLocalId. - */ - public long getPrevLocalId() { - return prevLocalId_; - } - /** - * int64 prev_local_id = 2; - * @param value The prevLocalId to set. - * @return This builder for chaining. - */ - public Builder setPrevLocalId(long value) { - - prevLocalId_ = value; - onChanged(); - return this; - } - /** - * int64 prev_local_id = 2; - * @return This builder for chaining. - */ - public Builder clearPrevLocalId() { - - prevLocalId_ = 0L; - onChanged(); - return this; - } - - private java.lang.Object action_ = ""; - /** - * string action = 3; - * @return The action. - */ - public java.lang.String getAction() { - java.lang.Object ref = action_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - action_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string action = 3; - * @return The bytes for action. - */ - public com.google.protobuf.ByteString - getActionBytes() { - java.lang.Object ref = action_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - action_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string action = 3; - * @param value The action to set. - * @return This builder for chaining. - */ - public Builder setAction( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - action_ = value; - onChanged(); - return this; - } - /** - * string action = 3; - * @return This builder for chaining. - */ - public Builder clearAction() { - - action_ = getDefaultInstance().getAction(); - onChanged(); - return this; - } - /** - * string action = 3; - * @param value The bytes for action to set. - * @return This builder for chaining. - */ - public Builder setActionBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - action_ = value; - onChanged(); - return this; - } - - private java.lang.Object object_ = ""; - /** - * string object = 4; - * @return The object. - */ - public java.lang.String getObject() { - java.lang.Object ref = object_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - object_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string object = 4; - * @return The bytes for object. - */ - public com.google.protobuf.ByteString - getObjectBytes() { - java.lang.Object ref = object_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - object_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string object = 4; - * @param value The object to set. - * @return This builder for chaining. - */ - public Builder setObject( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - object_ = value; - onChanged(); - return this; - } - /** - * string object = 4; - * @return This builder for chaining. - */ - public Builder clearObject() { - - object_ = getDefaultInstance().getObject(); - onChanged(); - return this; - } - /** - * string object = 4; - * @param value The bytes for object to set. - * @return This builder for chaining. - */ - public Builder setObjectBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - object_ = value; - onChanged(); - return this; - } - - private int currentScreenId_ ; - /** - * int32 current_screen_id = 5; - * @return The currentScreenId. - */ - public int getCurrentScreenId() { - return currentScreenId_; - } - /** - * int32 current_screen_id = 5; - * @param value The currentScreenId to set. - * @return This builder for chaining. - */ - public Builder setCurrentScreenId(int value) { - - currentScreenId_ = value; - onChanged(); - return this; - } - /** - * int32 current_screen_id = 5; - * @return This builder for chaining. - */ - public Builder clearCurrentScreenId() { - - currentScreenId_ = 0; - onChanged(); - return this; - } - - private com.google.protobuf.Internal.IntList screenStack_ = emptyIntList(); - private void ensureScreenStackIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - screenStack_ = mutableCopy(screenStack_); - bitField0_ |= 0x00000001; - } - } - /** - *
-     *    repeated Event events = 7; TODO
-     * 
- * - * repeated int32 screen_stack = 6; - * @return A list containing the screenStack. - */ - public java.util.List - getScreenStackList() { - return ((bitField0_ & 0x00000001) != 0) ? - java.util.Collections.unmodifiableList(screenStack_) : screenStack_; - } - /** - *
-     *    repeated Event events = 7; TODO
-     * 
- * - * repeated int32 screen_stack = 6; - * @return The count of screenStack. - */ - public int getScreenStackCount() { - return screenStack_.size(); - } - /** - *
-     *    repeated Event events = 7; TODO
-     * 
- * - * repeated int32 screen_stack = 6; - * @param index The index of the element to return. - * @return The screenStack at the given index. - */ - public int getScreenStack(int index) { - return screenStack_.getInt(index); - } - /** - *
-     *    repeated Event events = 7; TODO
-     * 
- * - * repeated int32 screen_stack = 6; - * @param index The index to set the value at. - * @param value The screenStack to set. - * @return This builder for chaining. - */ - public Builder setScreenStack( - int index, int value) { - ensureScreenStackIsMutable(); - screenStack_.setInt(index, value); - onChanged(); - return this; - } - /** - *
-     *    repeated Event events = 7; TODO
-     * 
- * - * repeated int32 screen_stack = 6; - * @param value The screenStack to add. - * @return This builder for chaining. - */ - public Builder addScreenStack(int value) { - ensureScreenStackIsMutable(); - screenStack_.addInt(value); - onChanged(); - return this; - } - /** - *
-     *    repeated Event events = 7; TODO
-     * 
- * - * repeated int32 screen_stack = 6; - * @param values The screenStack to add. - * @return This builder for chaining. - */ - public Builder addAllScreenStack( - java.lang.Iterable values) { - ensureScreenStackIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, screenStack_); - onChanged(); - return this; - } - /** - *
-     *    repeated Event events = 7; TODO
-     * 
- * - * repeated int32 screen_stack = 6; - * @return This builder for chaining. - */ - public Builder clearScreenStack() { - screenStack_ = emptyIntList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - - private com.google.protobuf.MapField< - java.lang.String, java.lang.String> attributes_; - private com.google.protobuf.MapField - internalGetAttributes() { - if (attributes_ == null) { - return com.google.protobuf.MapField.emptyMapField( - AttributesDefaultEntryHolder.defaultEntry); - } - return attributes_; - } - private com.google.protobuf.MapField - internalGetMutableAttributes() { - onChanged();; - if (attributes_ == null) { - attributes_ = com.google.protobuf.MapField.newMapField( - AttributesDefaultEntryHolder.defaultEntry); - } - if (!attributes_.isMutable()) { - attributes_ = attributes_.copy(); - } - return attributes_; - } - - public int getAttributesCount() { - return internalGetAttributes().getMap().size(); - } - /** - * map<string, string> attributes = 8; - */ - - public boolean containsAttributes( - java.lang.String key) { - if (key == null) { throw new java.lang.NullPointerException(); } - return internalGetAttributes().getMap().containsKey(key); - } - /** - * Use {@link #getAttributesMap()} instead. - */ - @java.lang.Deprecated - public java.util.Map getAttributes() { - return getAttributesMap(); - } - /** - * map<string, string> attributes = 8; - */ - - public java.util.Map getAttributesMap() { - return internalGetAttributes().getMap(); - } - /** - * map<string, string> attributes = 8; - */ - - public java.lang.String getAttributesOrDefault( - java.lang.String key, - java.lang.String defaultValue) { - if (key == null) { throw new java.lang.NullPointerException(); } - java.util.Map map = - internalGetAttributes().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; - } - /** - * map<string, string> attributes = 8; - */ - - public java.lang.String getAttributesOrThrow( - java.lang.String key) { - if (key == null) { throw new java.lang.NullPointerException(); } - java.util.Map map = - internalGetAttributes().getMap(); - if (!map.containsKey(key)) { - throw new java.lang.IllegalArgumentException(); - } - return map.get(key); - } - - public Builder clearAttributes() { - internalGetMutableAttributes().getMutableMap() - .clear(); - return this; - } - /** - * map<string, string> attributes = 8; - */ - - public Builder removeAttributes( - java.lang.String key) { - if (key == null) { throw new java.lang.NullPointerException(); } - internalGetMutableAttributes().getMutableMap() - .remove(key); - return this; - } - /** - * Use alternate mutation accessors instead. - */ - @java.lang.Deprecated - public java.util.Map - getMutableAttributes() { - return internalGetMutableAttributes().getMutableMap(); - } - /** - * map<string, string> attributes = 8; - */ - public Builder putAttributes( - java.lang.String key, - java.lang.String value) { - if (key == null) { throw new java.lang.NullPointerException(); } - if (value == null) { throw new java.lang.NullPointerException(); } - internalGetMutableAttributes().getMutableMap() - .put(key, value); - return this; - } - /** - * map<string, string> attributes = 8; - */ - - public Builder putAllAttributes( - java.util.Map values) { - internalGetMutableAttributes().getMutableMap() - .putAll(values); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:Action) - } - - // @@protoc_insertion_point(class_scope:Action) - private static final tech.donau.behaiv.proto.Action DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new tech.donau.behaiv.proto.Action(); - } - - public static tech.donau.behaiv.proto.Action getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Action parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Action(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Action getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java deleted file mode 100644 index dfc71cf..0000000 --- a/src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java +++ /dev/null @@ -1,114 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: behaiv.proto - -package tech.donau.behaiv.proto; - -public interface ActionOrBuilder extends - // @@protoc_insertion_point(interface_extends:Action) - com.google.protobuf.MessageOrBuilder { - - /** - * int64 local_id = 1; - * @return The localId. - */ - long getLocalId(); - - /** - * int64 prev_local_id = 2; - * @return The prevLocalId. - */ - long getPrevLocalId(); - - /** - * string action = 3; - * @return The action. - */ - java.lang.String getAction(); - /** - * string action = 3; - * @return The bytes for action. - */ - com.google.protobuf.ByteString - getActionBytes(); - - /** - * string object = 4; - * @return The object. - */ - java.lang.String getObject(); - /** - * string object = 4; - * @return The bytes for object. - */ - com.google.protobuf.ByteString - getObjectBytes(); - - /** - * int32 current_screen_id = 5; - * @return The currentScreenId. - */ - int getCurrentScreenId(); - - /** - *
-   *    repeated Event events = 7; TODO
-   * 
- * - * repeated int32 screen_stack = 6; - * @return A list containing the screenStack. - */ - java.util.List getScreenStackList(); - /** - *
-   *    repeated Event events = 7; TODO
-   * 
- * - * repeated int32 screen_stack = 6; - * @return The count of screenStack. - */ - int getScreenStackCount(); - /** - *
-   *    repeated Event events = 7; TODO
-   * 
- * - * repeated int32 screen_stack = 6; - * @param index The index of the element to return. - * @return The screenStack at the given index. - */ - int getScreenStack(int index); - - /** - * map<string, string> attributes = 8; - */ - int getAttributesCount(); - /** - * map<string, string> attributes = 8; - */ - boolean containsAttributes( - java.lang.String key); - /** - * Use {@link #getAttributesMap()} instead. - */ - @java.lang.Deprecated - java.util.Map - getAttributes(); - /** - * map<string, string> attributes = 8; - */ - java.util.Map - getAttributesMap(); - /** - * map<string, string> attributes = 8; - */ - - java.lang.String getAttributesOrDefault( - java.lang.String key, - java.lang.String defaultValue); - /** - * map<string, string> attributes = 8; - */ - - java.lang.String getAttributesOrThrow( - java.lang.String key); -} diff --git a/src/main/java/tech/donau/behaiv/proto/Behaiv.java b/src/main/java/tech/donau/behaiv/proto/Behaiv.java deleted file mode 100644 index 7b718d0..0000000 --- a/src/main/java/tech/donau/behaiv/proto/Behaiv.java +++ /dev/null @@ -1,113 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: behaiv.proto - -package tech.donau.behaiv.proto; - -public final class Behaiv { - private Behaiv() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - static final com.google.protobuf.Descriptors.Descriptor - internal_static_Data_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Data_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_Prediction_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Prediction_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_PredictionSet_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_PredictionSet_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_Action_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Action_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_Action_AttributesEntry_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Action_AttributesEntry_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_Screen_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Screen_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\014behaiv.proto\"(\n\004Data\022\013\n\003key\030\002 \001(\t\022\r\n\005v" + - "alue\030\003 \001(\001J\004\010\001\020\002\"0\n\nPrediction\022\023\n\004data\030\001" + - " \003(\0132\005.Data\022\r\n\005label\030\002 \001(\t\"H\n\rPrediction" + - "Set\022\037\n\nprediction\030\001 \003(\0132\013.Prediction\022\026\n\016" + - "dynamicColumns\030\002 \001(\010\"\342\001\n\006Action\022\020\n\010local" + - "_id\030\001 \001(\003\022\025\n\rprev_local_id\030\002 \001(\003\022\016\n\006acti" + - "on\030\003 \001(\t\022\016\n\006object\030\004 \001(\t\022\031\n\021current_scre" + - "en_id\030\005 \001(\005\022\024\n\014screen_stack\030\006 \003(\005\022+\n\natt" + - "ributes\030\010 \003(\0132\027.Action.AttributesEntry\0321" + - "\n\017AttributesEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030" + - "\002 \001(\t:\0028\001\"\"\n\006Screen\022\n\n\002id\030\001 \001(\005\022\014\n\004name\030" + - "\002 \001(\tB\033\n\027tech.donau.behaiv.protoP\001b\006prot" + - "o3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }); - internal_static_Data_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_Data_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Data_descriptor, - new java.lang.String[] { "Key", "Value", }); - internal_static_Prediction_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_Prediction_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Prediction_descriptor, - new java.lang.String[] { "Data", "Label", }); - internal_static_PredictionSet_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_PredictionSet_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_PredictionSet_descriptor, - new java.lang.String[] { "Prediction", "DynamicColumns", }); - internal_static_Action_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_Action_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Action_descriptor, - new java.lang.String[] { "LocalId", "PrevLocalId", "Action", "Object", "CurrentScreenId", "ScreenStack", "Attributes", }); - internal_static_Action_AttributesEntry_descriptor = - internal_static_Action_descriptor.getNestedTypes().get(0); - internal_static_Action_AttributesEntry_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Action_AttributesEntry_descriptor, - new java.lang.String[] { "Key", "Value", }); - internal_static_Screen_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_Screen_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Screen_descriptor, - new java.lang.String[] { "Id", "Name", }); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/src/main/java/tech/donau/behaiv/proto/Data.java b/src/main/java/tech/donau/behaiv/proto/Data.java deleted file mode 100644 index 39ddec0..0000000 --- a/src/main/java/tech/donau/behaiv/proto/Data.java +++ /dev/null @@ -1,627 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: behaiv.proto - -package tech.donau.behaiv.proto; - -/** - *
- * Data messages
- * 
- * - * Protobuf type {@code Data} - */ -public final class Data extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Data) - DataOrBuilder { -private static final long serialVersionUID = 0L; - // Use Data.newBuilder() to construct. - private Data(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Data() { - key_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new Data(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Data( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - 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; - case 18: { - java.lang.String s = input.readStringRequireUtf8(); - - key_ = s; - break; - } - case 25: { - - value_ = input.readDouble(); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - 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 tech.donau.behaiv.proto.Behaiv.internal_static_Data_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Data_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tech.donau.behaiv.proto.Data.class, tech.donau.behaiv.proto.Data.Builder.class); - } - - public static final int KEY_FIELD_NUMBER = 2; - private volatile java.lang.Object key_; - /** - * string key = 2; - * @return The key. - */ - public java.lang.String getKey() { - java.lang.Object ref = key_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - key_ = s; - return s; - } - } - /** - * string key = 2; - * @return The bytes for key. - */ - public com.google.protobuf.ByteString - getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int VALUE_FIELD_NUMBER = 3; - private double value_; - /** - * double value = 3; - * @return The value. - */ - public double getValue() { - return value_; - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!getKeyBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, key_); - } - if (value_ != 0D) { - output.writeDouble(3, value_); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!getKeyBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, key_); - } - if (value_ != 0D) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(3, value_); - } - 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 tech.donau.behaiv.proto.Data)) { - return super.equals(obj); - } - tech.donau.behaiv.proto.Data other = (tech.donau.behaiv.proto.Data) obj; - - if (!getKey() - .equals(other.getKey())) return false; - if (java.lang.Double.doubleToLongBits(getValue()) - != java.lang.Double.doubleToLongBits( - other.getValue())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + KEY_FIELD_NUMBER; - hash = (53 * hash) + getKey().hashCode(); - hash = (37 * hash) + VALUE_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - java.lang.Double.doubleToLongBits(getValue())); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static tech.donau.behaiv.proto.Data parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Data parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Data parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Data parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Data parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Data parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Data parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Data 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 tech.donau.behaiv.proto.Data parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Data 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 tech.donau.behaiv.proto.Data parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Data parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(tech.donau.behaiv.proto.Data prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - 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; - } - /** - *
-   * Data messages
-   * 
- * - * Protobuf type {@code Data} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Data) - tech.donau.behaiv.proto.DataOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Data_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Data_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tech.donau.behaiv.proto.Data.class, tech.donau.behaiv.proto.Data.Builder.class); - } - - // Construct using tech.donau.behaiv.proto.Data.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - @java.lang.Override - public Builder clear() { - super.clear(); - key_ = ""; - - value_ = 0D; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Data_descriptor; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Data getDefaultInstanceForType() { - return tech.donau.behaiv.proto.Data.getDefaultInstance(); - } - - @java.lang.Override - public tech.donau.behaiv.proto.Data build() { - tech.donau.behaiv.proto.Data result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Data buildPartial() { - tech.donau.behaiv.proto.Data result = new tech.donau.behaiv.proto.Data(this); - result.key_ = key_; - result.value_ = value_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof tech.donau.behaiv.proto.Data) { - return mergeFrom((tech.donau.behaiv.proto.Data)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(tech.donau.behaiv.proto.Data other) { - if (other == tech.donau.behaiv.proto.Data.getDefaultInstance()) return this; - if (!other.getKey().isEmpty()) { - key_ = other.key_; - onChanged(); - } - if (other.getValue() != 0D) { - setValue(other.getValue()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - tech.donau.behaiv.proto.Data parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (tech.donau.behaiv.proto.Data) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private java.lang.Object key_ = ""; - /** - * string key = 2; - * @return The key. - */ - public java.lang.String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - key_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string key = 2; - * @return The bytes for key. - */ - public com.google.protobuf.ByteString - getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string key = 2; - * @param value The key to set. - * @return This builder for chaining. - */ - public Builder setKey( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - key_ = value; - onChanged(); - return this; - } - /** - * string key = 2; - * @return This builder for chaining. - */ - public Builder clearKey() { - - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - /** - * string key = 2; - * @param value The bytes for key to set. - * @return This builder for chaining. - */ - public Builder setKeyBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - key_ = value; - onChanged(); - return this; - } - - private double value_ ; - /** - * double value = 3; - * @return The value. - */ - public double getValue() { - return value_; - } - /** - * double value = 3; - * @param value The value to set. - * @return This builder for chaining. - */ - public Builder setValue(double value) { - - value_ = value; - onChanged(); - return this; - } - /** - * double value = 3; - * @return This builder for chaining. - */ - public Builder clearValue() { - - value_ = 0D; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:Data) - } - - // @@protoc_insertion_point(class_scope:Data) - private static final tech.donau.behaiv.proto.Data DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new tech.donau.behaiv.proto.Data(); - } - - public static tech.donau.behaiv.proto.Data getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Data parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Data(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Data getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java deleted file mode 100644 index f82daf4..0000000 --- a/src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java +++ /dev/null @@ -1,27 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: behaiv.proto - -package tech.donau.behaiv.proto; - -public interface DataOrBuilder extends - // @@protoc_insertion_point(interface_extends:Data) - com.google.protobuf.MessageOrBuilder { - - /** - * string key = 2; - * @return The key. - */ - java.lang.String getKey(); - /** - * string key = 2; - * @return The bytes for key. - */ - com.google.protobuf.ByteString - getKeyBytes(); - - /** - * double value = 3; - * @return The value. - */ - double getValue(); -} diff --git a/src/main/java/tech/donau/behaiv/proto/Prediction.java b/src/main/java/tech/donau/behaiv/proto/Prediction.java deleted file mode 100644 index c7188c3..0000000 --- a/src/main/java/tech/donau/behaiv/proto/Prediction.java +++ /dev/null @@ -1,901 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: behaiv.proto - -package tech.donau.behaiv.proto; - -/** - * Protobuf type {@code Prediction} - */ -public final class Prediction extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Prediction) - PredictionOrBuilder { -private static final long serialVersionUID = 0L; - // Use Prediction.newBuilder() to construct. - private Prediction(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Prediction() { - data_ = java.util.Collections.emptyList(); - label_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new Prediction(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Prediction( - 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; - case 10: { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - data_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - data_.add( - input.readMessage(tech.donau.behaiv.proto.Data.parser(), extensionRegistry)); - break; - } - case 18: { - java.lang.String s = input.readStringRequireUtf8(); - - label_ = s; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - 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) != 0)) { - data_ = java.util.Collections.unmodifiableList(data_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Prediction_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Prediction_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tech.donau.behaiv.proto.Prediction.class, tech.donau.behaiv.proto.Prediction.Builder.class); - } - - public static final int DATA_FIELD_NUMBER = 1; - private java.util.List data_; - /** - * repeated .Data data = 1; - */ - public java.util.List getDataList() { - return data_; - } - /** - * repeated .Data data = 1; - */ - public java.util.List - getDataOrBuilderList() { - return data_; - } - /** - * repeated .Data data = 1; - */ - public int getDataCount() { - return data_.size(); - } - /** - * repeated .Data data = 1; - */ - public tech.donau.behaiv.proto.Data getData(int index) { - return data_.get(index); - } - /** - * repeated .Data data = 1; - */ - public tech.donau.behaiv.proto.DataOrBuilder getDataOrBuilder( - int index) { - return data_.get(index); - } - - public static final int LABEL_FIELD_NUMBER = 2; - private volatile java.lang.Object label_; - /** - * string label = 2; - * @return The label. - */ - public java.lang.String getLabel() { - java.lang.Object ref = label_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - label_ = s; - return s; - } - } - /** - * string label = 2; - * @return The bytes for label. - */ - public com.google.protobuf.ByteString - getLabelBytes() { - java.lang.Object ref = label_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - label_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - for (int i = 0; i < data_.size(); i++) { - output.writeMessage(1, data_.get(i)); - } - if (!getLabelBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, label_); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < data_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, data_.get(i)); - } - if (!getLabelBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, label_); - } - 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 tech.donau.behaiv.proto.Prediction)) { - return super.equals(obj); - } - tech.donau.behaiv.proto.Prediction other = (tech.donau.behaiv.proto.Prediction) obj; - - if (!getDataList() - .equals(other.getDataList())) return false; - if (!getLabel() - .equals(other.getLabel())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getDataCount() > 0) { - hash = (37 * hash) + DATA_FIELD_NUMBER; - hash = (53 * hash) + getDataList().hashCode(); - } - hash = (37 * hash) + LABEL_FIELD_NUMBER; - hash = (53 * hash) + getLabel().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static tech.donau.behaiv.proto.Prediction parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Prediction parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Prediction parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Prediction parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Prediction parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Prediction parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Prediction parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Prediction 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 tech.donau.behaiv.proto.Prediction parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Prediction 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 tech.donau.behaiv.proto.Prediction parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Prediction parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(tech.donau.behaiv.proto.Prediction prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - 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 Prediction} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Prediction) - tech.donau.behaiv.proto.PredictionOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Prediction_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Prediction_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tech.donau.behaiv.proto.Prediction.class, tech.donau.behaiv.proto.Prediction.Builder.class); - } - - // Construct using tech.donau.behaiv.proto.Prediction.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getDataFieldBuilder(); - } - } - @java.lang.Override - public Builder clear() { - super.clear(); - if (dataBuilder_ == null) { - data_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - dataBuilder_.clear(); - } - label_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Prediction_descriptor; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Prediction getDefaultInstanceForType() { - return tech.donau.behaiv.proto.Prediction.getDefaultInstance(); - } - - @java.lang.Override - public tech.donau.behaiv.proto.Prediction build() { - tech.donau.behaiv.proto.Prediction result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Prediction buildPartial() { - tech.donau.behaiv.proto.Prediction result = new tech.donau.behaiv.proto.Prediction(this); - int from_bitField0_ = bitField0_; - if (dataBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - data_ = java.util.Collections.unmodifiableList(data_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.data_ = data_; - } else { - result.data_ = dataBuilder_.build(); - } - result.label_ = label_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof tech.donau.behaiv.proto.Prediction) { - return mergeFrom((tech.donau.behaiv.proto.Prediction)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(tech.donau.behaiv.proto.Prediction other) { - if (other == tech.donau.behaiv.proto.Prediction.getDefaultInstance()) return this; - if (dataBuilder_ == null) { - if (!other.data_.isEmpty()) { - if (data_.isEmpty()) { - data_ = other.data_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureDataIsMutable(); - data_.addAll(other.data_); - } - onChanged(); - } - } else { - if (!other.data_.isEmpty()) { - if (dataBuilder_.isEmpty()) { - dataBuilder_.dispose(); - dataBuilder_ = null; - data_ = other.data_; - bitField0_ = (bitField0_ & ~0x00000001); - dataBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getDataFieldBuilder() : null; - } else { - dataBuilder_.addAllMessages(other.data_); - } - } - } - if (!other.getLabel().isEmpty()) { - label_ = other.label_; - onChanged(); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - tech.donau.behaiv.proto.Prediction parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (tech.donau.behaiv.proto.Prediction) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.util.List data_ = - java.util.Collections.emptyList(); - private void ensureDataIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - data_ = new java.util.ArrayList(data_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - tech.donau.behaiv.proto.Data, tech.donau.behaiv.proto.Data.Builder, tech.donau.behaiv.proto.DataOrBuilder> dataBuilder_; - - /** - * repeated .Data data = 1; - */ - public java.util.List getDataList() { - if (dataBuilder_ == null) { - return java.util.Collections.unmodifiableList(data_); - } else { - return dataBuilder_.getMessageList(); - } - } - /** - * repeated .Data data = 1; - */ - public int getDataCount() { - if (dataBuilder_ == null) { - return data_.size(); - } else { - return dataBuilder_.getCount(); - } - } - /** - * repeated .Data data = 1; - */ - public tech.donau.behaiv.proto.Data getData(int index) { - if (dataBuilder_ == null) { - return data_.get(index); - } else { - return dataBuilder_.getMessage(index); - } - } - /** - * repeated .Data data = 1; - */ - public Builder setData( - int index, tech.donau.behaiv.proto.Data value) { - if (dataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDataIsMutable(); - data_.set(index, value); - onChanged(); - } else { - dataBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .Data data = 1; - */ - public Builder setData( - int index, tech.donau.behaiv.proto.Data.Builder builderForValue) { - if (dataBuilder_ == null) { - ensureDataIsMutable(); - data_.set(index, builderForValue.build()); - onChanged(); - } else { - dataBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Data data = 1; - */ - public Builder addData(tech.donau.behaiv.proto.Data value) { - if (dataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDataIsMutable(); - data_.add(value); - onChanged(); - } else { - dataBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .Data data = 1; - */ - public Builder addData( - int index, tech.donau.behaiv.proto.Data value) { - if (dataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDataIsMutable(); - data_.add(index, value); - onChanged(); - } else { - dataBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .Data data = 1; - */ - public Builder addData( - tech.donau.behaiv.proto.Data.Builder builderForValue) { - if (dataBuilder_ == null) { - ensureDataIsMutable(); - data_.add(builderForValue.build()); - onChanged(); - } else { - dataBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .Data data = 1; - */ - public Builder addData( - int index, tech.donau.behaiv.proto.Data.Builder builderForValue) { - if (dataBuilder_ == null) { - ensureDataIsMutable(); - data_.add(index, builderForValue.build()); - onChanged(); - } else { - dataBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Data data = 1; - */ - public Builder addAllData( - java.lang.Iterable values) { - if (dataBuilder_ == null) { - ensureDataIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, data_); - onChanged(); - } else { - dataBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .Data data = 1; - */ - public Builder clearData() { - if (dataBuilder_ == null) { - data_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - dataBuilder_.clear(); - } - return this; - } - /** - * repeated .Data data = 1; - */ - public Builder removeData(int index) { - if (dataBuilder_ == null) { - ensureDataIsMutable(); - data_.remove(index); - onChanged(); - } else { - dataBuilder_.remove(index); - } - return this; - } - /** - * repeated .Data data = 1; - */ - public tech.donau.behaiv.proto.Data.Builder getDataBuilder( - int index) { - return getDataFieldBuilder().getBuilder(index); - } - /** - * repeated .Data data = 1; - */ - public tech.donau.behaiv.proto.DataOrBuilder getDataOrBuilder( - int index) { - if (dataBuilder_ == null) { - return data_.get(index); } else { - return dataBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .Data data = 1; - */ - public java.util.List - getDataOrBuilderList() { - if (dataBuilder_ != null) { - return dataBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(data_); - } - } - /** - * repeated .Data data = 1; - */ - public tech.donau.behaiv.proto.Data.Builder addDataBuilder() { - return getDataFieldBuilder().addBuilder( - tech.donau.behaiv.proto.Data.getDefaultInstance()); - } - /** - * repeated .Data data = 1; - */ - public tech.donau.behaiv.proto.Data.Builder addDataBuilder( - int index) { - return getDataFieldBuilder().addBuilder( - index, tech.donau.behaiv.proto.Data.getDefaultInstance()); - } - /** - * repeated .Data data = 1; - */ - public java.util.List - getDataBuilderList() { - return getDataFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - tech.donau.behaiv.proto.Data, tech.donau.behaiv.proto.Data.Builder, tech.donau.behaiv.proto.DataOrBuilder> - getDataFieldBuilder() { - if (dataBuilder_ == null) { - dataBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - tech.donau.behaiv.proto.Data, tech.donau.behaiv.proto.Data.Builder, tech.donau.behaiv.proto.DataOrBuilder>( - data_, - ((bitField0_ & 0x00000001) != 0), - getParentForChildren(), - isClean()); - data_ = null; - } - return dataBuilder_; - } - - private java.lang.Object label_ = ""; - /** - * string label = 2; - * @return The label. - */ - public java.lang.String getLabel() { - java.lang.Object ref = label_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - label_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string label = 2; - * @return The bytes for label. - */ - public com.google.protobuf.ByteString - getLabelBytes() { - java.lang.Object ref = label_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - label_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string label = 2; - * @param value The label to set. - * @return This builder for chaining. - */ - public Builder setLabel( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - label_ = value; - onChanged(); - return this; - } - /** - * string label = 2; - * @return This builder for chaining. - */ - public Builder clearLabel() { - - label_ = getDefaultInstance().getLabel(); - onChanged(); - return this; - } - /** - * string label = 2; - * @param value The bytes for label to set. - * @return This builder for chaining. - */ - public Builder setLabelBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - label_ = value; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:Prediction) - } - - // @@protoc_insertion_point(class_scope:Prediction) - private static final tech.donau.behaiv.proto.Prediction DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new tech.donau.behaiv.proto.Prediction(); - } - - public static tech.donau.behaiv.proto.Prediction getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Prediction parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Prediction(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Prediction getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java deleted file mode 100644 index 740e6ae..0000000 --- a/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java +++ /dev/null @@ -1,45 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: behaiv.proto - -package tech.donau.behaiv.proto; - -public interface PredictionOrBuilder extends - // @@protoc_insertion_point(interface_extends:Prediction) - com.google.protobuf.MessageOrBuilder { - - /** - * repeated .Data data = 1; - */ - java.util.List - getDataList(); - /** - * repeated .Data data = 1; - */ - tech.donau.behaiv.proto.Data getData(int index); - /** - * repeated .Data data = 1; - */ - int getDataCount(); - /** - * repeated .Data data = 1; - */ - java.util.List - getDataOrBuilderList(); - /** - * repeated .Data data = 1; - */ - tech.donau.behaiv.proto.DataOrBuilder getDataOrBuilder( - int index); - - /** - * string label = 2; - * @return The label. - */ - java.lang.String getLabel(); - /** - * string label = 2; - * @return The bytes for label. - */ - com.google.protobuf.ByteString - getLabelBytes(); -} diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionSet.java b/src/main/java/tech/donau/behaiv/proto/PredictionSet.java deleted file mode 100644 index 6e11bf1..0000000 --- a/src/main/java/tech/donau/behaiv/proto/PredictionSet.java +++ /dev/null @@ -1,828 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: behaiv.proto - -package tech.donau.behaiv.proto; - -/** - * Protobuf type {@code PredictionSet} - */ -public final class PredictionSet extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:PredictionSet) - PredictionSetOrBuilder { -private static final long serialVersionUID = 0L; - // Use PredictionSet.newBuilder() to construct. - private PredictionSet(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private PredictionSet() { - prediction_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new PredictionSet(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private PredictionSet( - 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; - case 10: { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - prediction_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - prediction_.add( - input.readMessage(tech.donau.behaiv.proto.Prediction.parser(), extensionRegistry)); - break; - } - case 16: { - - dynamicColumns_ = input.readBool(); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - 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) != 0)) { - prediction_ = java.util.Collections.unmodifiableList(prediction_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tech.donau.behaiv.proto.Behaiv.internal_static_PredictionSet_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return tech.donau.behaiv.proto.Behaiv.internal_static_PredictionSet_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tech.donau.behaiv.proto.PredictionSet.class, tech.donau.behaiv.proto.PredictionSet.Builder.class); - } - - public static final int PREDICTION_FIELD_NUMBER = 1; - private java.util.List prediction_; - /** - * repeated .Prediction prediction = 1; - */ - public java.util.List getPredictionList() { - return prediction_; - } - /** - * repeated .Prediction prediction = 1; - */ - public java.util.List - getPredictionOrBuilderList() { - return prediction_; - } - /** - * repeated .Prediction prediction = 1; - */ - public int getPredictionCount() { - return prediction_.size(); - } - /** - * repeated .Prediction prediction = 1; - */ - public tech.donau.behaiv.proto.Prediction getPrediction(int index) { - return prediction_.get(index); - } - /** - * repeated .Prediction prediction = 1; - */ - public tech.donau.behaiv.proto.PredictionOrBuilder getPredictionOrBuilder( - int index) { - return prediction_.get(index); - } - - public static final int DYNAMICCOLUMNS_FIELD_NUMBER = 2; - private boolean dynamicColumns_; - /** - * bool dynamicColumns = 2; - * @return The dynamicColumns. - */ - public boolean getDynamicColumns() { - return dynamicColumns_; - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - for (int i = 0; i < prediction_.size(); i++) { - output.writeMessage(1, prediction_.get(i)); - } - if (dynamicColumns_ != false) { - output.writeBool(2, dynamicColumns_); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < prediction_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, prediction_.get(i)); - } - if (dynamicColumns_ != false) { - size += com.google.protobuf.CodedOutputStream - .computeBoolSize(2, dynamicColumns_); - } - 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 tech.donau.behaiv.proto.PredictionSet)) { - return super.equals(obj); - } - tech.donau.behaiv.proto.PredictionSet other = (tech.donau.behaiv.proto.PredictionSet) obj; - - if (!getPredictionList() - .equals(other.getPredictionList())) return false; - if (getDynamicColumns() - != other.getDynamicColumns()) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getPredictionCount() > 0) { - hash = (37 * hash) + PREDICTION_FIELD_NUMBER; - hash = (53 * hash) + getPredictionList().hashCode(); - } - hash = (37 * hash) + DYNAMICCOLUMNS_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( - getDynamicColumns()); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static tech.donau.behaiv.proto.PredictionSet parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.PredictionSet parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.PredictionSet parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.PredictionSet parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.PredictionSet parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.PredictionSet parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.PredictionSet parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.PredictionSet 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 tech.donau.behaiv.proto.PredictionSet parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.PredictionSet 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 tech.donau.behaiv.proto.PredictionSet parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.PredictionSet parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(tech.donau.behaiv.proto.PredictionSet prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - 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 PredictionSet} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:PredictionSet) - tech.donau.behaiv.proto.PredictionSetOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tech.donau.behaiv.proto.Behaiv.internal_static_PredictionSet_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return tech.donau.behaiv.proto.Behaiv.internal_static_PredictionSet_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tech.donau.behaiv.proto.PredictionSet.class, tech.donau.behaiv.proto.PredictionSet.Builder.class); - } - - // Construct using tech.donau.behaiv.proto.PredictionSet.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getPredictionFieldBuilder(); - } - } - @java.lang.Override - public Builder clear() { - super.clear(); - if (predictionBuilder_ == null) { - prediction_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - predictionBuilder_.clear(); - } - dynamicColumns_ = false; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return tech.donau.behaiv.proto.Behaiv.internal_static_PredictionSet_descriptor; - } - - @java.lang.Override - public tech.donau.behaiv.proto.PredictionSet getDefaultInstanceForType() { - return tech.donau.behaiv.proto.PredictionSet.getDefaultInstance(); - } - - @java.lang.Override - public tech.donau.behaiv.proto.PredictionSet build() { - tech.donau.behaiv.proto.PredictionSet result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public tech.donau.behaiv.proto.PredictionSet buildPartial() { - tech.donau.behaiv.proto.PredictionSet result = new tech.donau.behaiv.proto.PredictionSet(this); - int from_bitField0_ = bitField0_; - if (predictionBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - prediction_ = java.util.Collections.unmodifiableList(prediction_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.prediction_ = prediction_; - } else { - result.prediction_ = predictionBuilder_.build(); - } - result.dynamicColumns_ = dynamicColumns_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof tech.donau.behaiv.proto.PredictionSet) { - return mergeFrom((tech.donau.behaiv.proto.PredictionSet)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(tech.donau.behaiv.proto.PredictionSet other) { - if (other == tech.donau.behaiv.proto.PredictionSet.getDefaultInstance()) return this; - if (predictionBuilder_ == null) { - if (!other.prediction_.isEmpty()) { - if (prediction_.isEmpty()) { - prediction_ = other.prediction_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensurePredictionIsMutable(); - prediction_.addAll(other.prediction_); - } - onChanged(); - } - } else { - if (!other.prediction_.isEmpty()) { - if (predictionBuilder_.isEmpty()) { - predictionBuilder_.dispose(); - predictionBuilder_ = null; - prediction_ = other.prediction_; - bitField0_ = (bitField0_ & ~0x00000001); - predictionBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getPredictionFieldBuilder() : null; - } else { - predictionBuilder_.addAllMessages(other.prediction_); - } - } - } - if (other.getDynamicColumns() != false) { - setDynamicColumns(other.getDynamicColumns()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - tech.donau.behaiv.proto.PredictionSet parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (tech.donau.behaiv.proto.PredictionSet) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.util.List prediction_ = - java.util.Collections.emptyList(); - private void ensurePredictionIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - prediction_ = new java.util.ArrayList(prediction_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - tech.donau.behaiv.proto.Prediction, tech.donau.behaiv.proto.Prediction.Builder, tech.donau.behaiv.proto.PredictionOrBuilder> predictionBuilder_; - - /** - * repeated .Prediction prediction = 1; - */ - public java.util.List getPredictionList() { - if (predictionBuilder_ == null) { - return java.util.Collections.unmodifiableList(prediction_); - } else { - return predictionBuilder_.getMessageList(); - } - } - /** - * repeated .Prediction prediction = 1; - */ - public int getPredictionCount() { - if (predictionBuilder_ == null) { - return prediction_.size(); - } else { - return predictionBuilder_.getCount(); - } - } - /** - * repeated .Prediction prediction = 1; - */ - public tech.donau.behaiv.proto.Prediction getPrediction(int index) { - if (predictionBuilder_ == null) { - return prediction_.get(index); - } else { - return predictionBuilder_.getMessage(index); - } - } - /** - * repeated .Prediction prediction = 1; - */ - public Builder setPrediction( - int index, tech.donau.behaiv.proto.Prediction value) { - if (predictionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePredictionIsMutable(); - prediction_.set(index, value); - onChanged(); - } else { - predictionBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .Prediction prediction = 1; - */ - public Builder setPrediction( - int index, tech.donau.behaiv.proto.Prediction.Builder builderForValue) { - if (predictionBuilder_ == null) { - ensurePredictionIsMutable(); - prediction_.set(index, builderForValue.build()); - onChanged(); - } else { - predictionBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Prediction prediction = 1; - */ - public Builder addPrediction(tech.donau.behaiv.proto.Prediction value) { - if (predictionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePredictionIsMutable(); - prediction_.add(value); - onChanged(); - } else { - predictionBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .Prediction prediction = 1; - */ - public Builder addPrediction( - int index, tech.donau.behaiv.proto.Prediction value) { - if (predictionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePredictionIsMutable(); - prediction_.add(index, value); - onChanged(); - } else { - predictionBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .Prediction prediction = 1; - */ - public Builder addPrediction( - tech.donau.behaiv.proto.Prediction.Builder builderForValue) { - if (predictionBuilder_ == null) { - ensurePredictionIsMutable(); - prediction_.add(builderForValue.build()); - onChanged(); - } else { - predictionBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .Prediction prediction = 1; - */ - public Builder addPrediction( - int index, tech.donau.behaiv.proto.Prediction.Builder builderForValue) { - if (predictionBuilder_ == null) { - ensurePredictionIsMutable(); - prediction_.add(index, builderForValue.build()); - onChanged(); - } else { - predictionBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Prediction prediction = 1; - */ - public Builder addAllPrediction( - java.lang.Iterable values) { - if (predictionBuilder_ == null) { - ensurePredictionIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, prediction_); - onChanged(); - } else { - predictionBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .Prediction prediction = 1; - */ - public Builder clearPrediction() { - if (predictionBuilder_ == null) { - prediction_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - predictionBuilder_.clear(); - } - return this; - } - /** - * repeated .Prediction prediction = 1; - */ - public Builder removePrediction(int index) { - if (predictionBuilder_ == null) { - ensurePredictionIsMutable(); - prediction_.remove(index); - onChanged(); - } else { - predictionBuilder_.remove(index); - } - return this; - } - /** - * repeated .Prediction prediction = 1; - */ - public tech.donau.behaiv.proto.Prediction.Builder getPredictionBuilder( - int index) { - return getPredictionFieldBuilder().getBuilder(index); - } - /** - * repeated .Prediction prediction = 1; - */ - public tech.donau.behaiv.proto.PredictionOrBuilder getPredictionOrBuilder( - int index) { - if (predictionBuilder_ == null) { - return prediction_.get(index); } else { - return predictionBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .Prediction prediction = 1; - */ - public java.util.List - getPredictionOrBuilderList() { - if (predictionBuilder_ != null) { - return predictionBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(prediction_); - } - } - /** - * repeated .Prediction prediction = 1; - */ - public tech.donau.behaiv.proto.Prediction.Builder addPredictionBuilder() { - return getPredictionFieldBuilder().addBuilder( - tech.donau.behaiv.proto.Prediction.getDefaultInstance()); - } - /** - * repeated .Prediction prediction = 1; - */ - public tech.donau.behaiv.proto.Prediction.Builder addPredictionBuilder( - int index) { - return getPredictionFieldBuilder().addBuilder( - index, tech.donau.behaiv.proto.Prediction.getDefaultInstance()); - } - /** - * repeated .Prediction prediction = 1; - */ - public java.util.List - getPredictionBuilderList() { - return getPredictionFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - tech.donau.behaiv.proto.Prediction, tech.donau.behaiv.proto.Prediction.Builder, tech.donau.behaiv.proto.PredictionOrBuilder> - getPredictionFieldBuilder() { - if (predictionBuilder_ == null) { - predictionBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - tech.donau.behaiv.proto.Prediction, tech.donau.behaiv.proto.Prediction.Builder, tech.donau.behaiv.proto.PredictionOrBuilder>( - prediction_, - ((bitField0_ & 0x00000001) != 0), - getParentForChildren(), - isClean()); - prediction_ = null; - } - return predictionBuilder_; - } - - private boolean dynamicColumns_ ; - /** - * bool dynamicColumns = 2; - * @return The dynamicColumns. - */ - public boolean getDynamicColumns() { - return dynamicColumns_; - } - /** - * bool dynamicColumns = 2; - * @param value The dynamicColumns to set. - * @return This builder for chaining. - */ - public Builder setDynamicColumns(boolean value) { - - dynamicColumns_ = value; - onChanged(); - return this; - } - /** - * bool dynamicColumns = 2; - * @return This builder for chaining. - */ - public Builder clearDynamicColumns() { - - dynamicColumns_ = false; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:PredictionSet) - } - - // @@protoc_insertion_point(class_scope:PredictionSet) - private static final tech.donau.behaiv.proto.PredictionSet DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new tech.donau.behaiv.proto.PredictionSet(); - } - - public static tech.donau.behaiv.proto.PredictionSet getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public PredictionSet parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new PredictionSet(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public tech.donau.behaiv.proto.PredictionSet getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java deleted file mode 100644 index 745e30e..0000000 --- a/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java +++ /dev/null @@ -1,39 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: behaiv.proto - -package tech.donau.behaiv.proto; - -public interface PredictionSetOrBuilder extends - // @@protoc_insertion_point(interface_extends:PredictionSet) - com.google.protobuf.MessageOrBuilder { - - /** - * repeated .Prediction prediction = 1; - */ - java.util.List - getPredictionList(); - /** - * repeated .Prediction prediction = 1; - */ - tech.donau.behaiv.proto.Prediction getPrediction(int index); - /** - * repeated .Prediction prediction = 1; - */ - int getPredictionCount(); - /** - * repeated .Prediction prediction = 1; - */ - java.util.List - getPredictionOrBuilderList(); - /** - * repeated .Prediction prediction = 1; - */ - tech.donau.behaiv.proto.PredictionOrBuilder getPredictionOrBuilder( - int index); - - /** - * bool dynamicColumns = 2; - * @return The dynamicColumns. - */ - boolean getDynamicColumns(); -} diff --git a/src/main/java/tech/donau/behaiv/proto/Screen.java b/src/main/java/tech/donau/behaiv/proto/Screen.java deleted file mode 100644 index 0c80fe3..0000000 --- a/src/main/java/tech/donau/behaiv/proto/Screen.java +++ /dev/null @@ -1,617 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: behaiv.proto - -package tech.donau.behaiv.proto; - -/** - * Protobuf type {@code Screen} - */ -public final class Screen extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Screen) - ScreenOrBuilder { -private static final long serialVersionUID = 0L; - // Use Screen.newBuilder() to construct. - private Screen(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Screen() { - name_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new Screen(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Screen( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - 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; - case 8: { - - id_ = input.readInt32(); - break; - } - case 18: { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - 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 tech.donau.behaiv.proto.Behaiv.internal_static_Screen_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Screen_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tech.donau.behaiv.proto.Screen.class, tech.donau.behaiv.proto.Screen.Builder.class); - } - - public static final int ID_FIELD_NUMBER = 1; - private int id_; - /** - * int32 id = 1; - * @return The id. - */ - public int getId() { - return id_; - } - - public static final int NAME_FIELD_NUMBER = 2; - private volatile java.lang.Object name_; - /** - * string name = 2; - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * string name = 2; - * @return The bytes for name. - */ - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (id_ != 0) { - output.writeInt32(1, id_); - } - if (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (id_ != 0) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(1, id_); - } - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_); - } - 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 tech.donau.behaiv.proto.Screen)) { - return super.equals(obj); - } - tech.donau.behaiv.proto.Screen other = (tech.donau.behaiv.proto.Screen) obj; - - if (getId() - != other.getId()) return false; - if (!getName() - .equals(other.getName())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + ID_FIELD_NUMBER; - hash = (53 * hash) + getId(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static tech.donau.behaiv.proto.Screen parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Screen parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Screen parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Screen parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Screen parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tech.donau.behaiv.proto.Screen parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tech.donau.behaiv.proto.Screen parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Screen 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 tech.donau.behaiv.proto.Screen parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Screen 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 tech.donau.behaiv.proto.Screen parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static tech.donau.behaiv.proto.Screen parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(tech.donau.behaiv.proto.Screen prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - 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 Screen} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Screen) - tech.donau.behaiv.proto.ScreenOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Screen_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Screen_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tech.donau.behaiv.proto.Screen.class, tech.donau.behaiv.proto.Screen.Builder.class); - } - - // Construct using tech.donau.behaiv.proto.Screen.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - @java.lang.Override - public Builder clear() { - super.clear(); - id_ = 0; - - name_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return tech.donau.behaiv.proto.Behaiv.internal_static_Screen_descriptor; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Screen getDefaultInstanceForType() { - return tech.donau.behaiv.proto.Screen.getDefaultInstance(); - } - - @java.lang.Override - public tech.donau.behaiv.proto.Screen build() { - tech.donau.behaiv.proto.Screen result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Screen buildPartial() { - tech.donau.behaiv.proto.Screen result = new tech.donau.behaiv.proto.Screen(this); - result.id_ = id_; - result.name_ = name_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof tech.donau.behaiv.proto.Screen) { - return mergeFrom((tech.donau.behaiv.proto.Screen)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(tech.donau.behaiv.proto.Screen other) { - if (other == tech.donau.behaiv.proto.Screen.getDefaultInstance()) return this; - if (other.getId() != 0) { - setId(other.getId()); - } - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - tech.donau.behaiv.proto.Screen parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (tech.donau.behaiv.proto.Screen) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int id_ ; - /** - * int32 id = 1; - * @return The id. - */ - public int getId() { - return id_; - } - /** - * int32 id = 1; - * @param value The id to set. - * @return This builder for chaining. - */ - public Builder setId(int value) { - - id_ = value; - onChanged(); - return this; - } - /** - * int32 id = 1; - * @return This builder for chaining. - */ - public Builder clearId() { - - id_ = 0; - onChanged(); - return this; - } - - private java.lang.Object name_ = ""; - /** - * string name = 2; - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string name = 2; - * @return The bytes for name. - */ - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string name = 2; - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * string name = 2; - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * string name = 2; - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:Screen) - } - - // @@protoc_insertion_point(class_scope:Screen) - private static final tech.donau.behaiv.proto.Screen DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new tech.donau.behaiv.proto.Screen(); - } - - public static tech.donau.behaiv.proto.Screen getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Screen parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Screen(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public tech.donau.behaiv.proto.Screen getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java deleted file mode 100644 index e258da2..0000000 --- a/src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java +++ /dev/null @@ -1,27 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: behaiv.proto - -package tech.donau.behaiv.proto; - -public interface ScreenOrBuilder extends - // @@protoc_insertion_point(interface_extends:Screen) - com.google.protobuf.MessageOrBuilder { - - /** - * int32 id = 1; - * @return The id. - */ - int getId(); - - /** - * string name = 2; - * @return The name. - */ - java.lang.String getName(); - /** - * string name = 2; - * @return The bytes for name. - */ - com.google.protobuf.ByteString - getNameBytes(); -} diff --git a/src/test/java/de/dmi3y/behaiv/BehaivTest.java b/src/test/java/de/dmi3y/behaiv/BehaivTest.java index 354eea4..9c9091b 100644 --- a/src/test/java/de/dmi3y/behaiv/BehaivTest.java +++ b/src/test/java/de/dmi3y/behaiv/BehaivTest.java @@ -1,6 +1,5 @@ package de.dmi3y.behaiv; -import de.dmi3y.behaiv.kernel.BaseKernel; import de.dmi3y.behaiv.kernel.Kernel; import de.dmi3y.behaiv.kernel.LogisticRegressionKernel; import de.dmi3y.behaiv.provider.DayTimeProvider; @@ -60,7 +59,7 @@ public void stopCapturing_whenDiscard_sessionShouldBeNull() { @Test public void startCapturing_tryToRestore_restoreNetwork() throws IOException { - final Kernel mockKernel = mock(BaseKernel.class); + final Kernel mockKernel = mock(Kernel.class); final BehaivStorage storage = mock(BehaivStorage.class); final Behaiv behaiv = new Behaiv.Builder("testId") .setKernel(mockKernel) @@ -76,7 +75,7 @@ public void startCapturing_tryToRestore_restoreNetwork() throws IOException { @Test public void startCapturing_withIOException_continueWithoutSaving() throws IOException { - final Kernel testKernel = mock(BaseKernel.class); + final Kernel testKernel = mock(Kernel.class); final BehaivStorage storage = mock(BehaivStorage.class); final Behaiv behaiv = Behaiv.with("testId") .setKernel(testKernel) diff --git a/src/test/java/de/dmi3y/behaiv/kernel/KernelTest.java b/src/test/java/de/dmi3y/behaiv/kernel/KernelTest.java index cf1d1bd..78cde5f 100644 --- a/src/test/java/de/dmi3y/behaiv/kernel/KernelTest.java +++ b/src/test/java/de/dmi3y/behaiv/kernel/KernelTest.java @@ -6,8 +6,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import tech.donau.behaiv.proto.Data; -import tech.donau.behaiv.proto.Prediction; import java.io.File; import java.io.IOException; @@ -42,12 +40,8 @@ public void setUp() throws Exception { @Test public void setTreshold() { dummyKernel.setTreshold(1L); - final Prediction prediction = Prediction.newBuilder().addData( - Data.newBuilder().setKey("null").setValue(0.0D).build() - ).addData( - Data.newBuilder().setKey("null2").setValue(0.0D).build()).build(); - dummyKernel.data = dummyKernel.data.toBuilder() - .addPrediction(prediction).addPrediction(prediction).build(); + dummyKernel.data.add(new Pair, String>(null, null)); + dummyKernel.data.add(new Pair, String>(null, null)); boolean readyToPredict = dummyKernel.readyToPredict(); assertTrue(readyToPredict); dummyKernel.setTreshold(10L); diff --git a/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java b/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java index 2157575..1a6fdf4 100644 --- a/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java +++ b/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java @@ -1,7 +1,6 @@ package de.dmi3y.behaiv.kernel; import de.dmi3y.behaiv.storage.SimpleStorage; -import de.dmi3y.behaiv.tools.DataMappingUtils; import de.dmi3y.behaiv.tools.Pair; import org.junit.Before; import org.junit.Rule; @@ -16,6 +15,7 @@ import static de.dmi3y.behaiv.kernel.KernelTest.HOME; import static de.dmi3y.behaiv.kernel.KernelTest.WORK; +import static de.dmi3y.behaiv.kernel.KernelTest.getTrainingData; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -57,12 +57,6 @@ public void predictOne() { assertEquals("SELFIMPROVEMENT_SCREEN", prediction); } - @Test - public void isPartialFitAllowed_inLogisticRegression_shouldReturnFalse() { - final Kernel kernel = new LogisticRegressionKernel("testId"); - assertFalse(kernel.isPartialFitAllowed()); - } - @Test public void storeResults() throws IOException, ClassNotFoundException { List, String>> data = KernelTest.getTrainingData(); @@ -151,8 +145,8 @@ public void storeResults_saveWhenDataIsNull_expectException() throws IOException public void storeResults_saveDataAndThenTheta_expectNormalFlow() throws IOException, ClassNotFoundException { List, String>> data = KernelTest.getTrainingData(); LogisticRegressionKernel kernel = new LogisticRegressionKernel("storeTest", new Random()); - kernel.data = DataMappingUtils.createPredictionSet(data); - kernel.cachedLables = Arrays.asList("time", "lat", "lon", "headphones"); + kernel.data = data; + kernel.labels = Arrays.asList("time", "lat", "lon", "headphones"); //Omit fit // kernel.fit(data); ArrayList predictList = new ArrayList<>(); @@ -167,7 +161,8 @@ public void storeResults_saveDataAndThenTheta_expectNormalFlow() throws IOExcept kernel = new LogisticRegressionKernel("storeTest"); kernel.restore(storage); - assertFalse(kernel.data.getPredictionList().isEmpty()); + assertFalse(kernel.data.isEmpty()); + kernel.data.get(0).getKey(); kernel.fit(data); String prediction = kernel.predictOne(predictList); diff --git a/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java b/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java index 3468804..09e218e 100644 --- a/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java +++ b/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java @@ -1,36 +1,18 @@ package de.dmi3y.behaiv.tools; import org.junit.Test; -import tech.donau.behaiv.proto.Prediction; -import tech.donau.behaiv.proto.PredictionSet; +import org.mockito.internal.matchers.Null; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import static org.hamcrest.CoreMatchers.hasItem; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; public class DataMappingUtilsTest { - - @Test - public void createPredictionSet_feedDefaultTestData_expectCorrectOrder() { - final Pair, String> mockData = getMockPairListDoubleStringData(); - final PredictionSet predictionSet = DataMappingUtils.createPredictionSet(Collections.singletonList(mockData)); - assertEquals(1, predictionSet.getPredictionCount()); - final Prediction prediction = predictionSet.getPrediction(0); - assertEquals("Potato", prediction.getLabel()); - assertEquals(1, prediction.getDataCount()); - assertEquals("key0", prediction.getData(0).getKey()); - assertEquals(20d, prediction.getData(0).getValue(), 0); - } - @Test public void toDistinctListOfPairValues_withInputData_returnsExpectedDistinctListOfPairValues() { List, String>> mockData = Arrays.asList( @@ -91,7 +73,7 @@ public void toInput2dArray_withEmptyListOfInputData_returnsEmpty2dArray() { @Test(expected = NullPointerException.class) public void toInput2dArray_withNull_throwsNullPointerException() { - DataMappingUtils.toInput2dArray((List, String>>) null); + DataMappingUtils.toInput2dArray(null); } From 577bb7b0e7428deee4598398b3a8f33245ed545c Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 10:20:59 +0100 Subject: [PATCH 11/23] Made Kernel.java as interface, extracted class into BaseKernel.java --- .../de/dmi3y/behaiv/kernel/BaseKernel.java | 100 ++++++++++++++++++ .../java/de/dmi3y/behaiv/kernel/Kernel.java | 88 +++------------ .../kernel/LogisticRegressionKernel.java | 2 +- src/test/java/de/dmi3y/behaiv/BehaivTest.java | 5 +- 4 files changed, 119 insertions(+), 76 deletions(-) create mode 100644 src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java diff --git a/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java b/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java new file mode 100644 index 0000000..04ef86b --- /dev/null +++ b/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java @@ -0,0 +1,100 @@ +package de.dmi3y.behaiv.kernel; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import de.dmi3y.behaiv.storage.BehaivStorage; +import de.dmi3y.behaiv.tools.Pair; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public abstract class BaseKernel implements Kernel { + + protected String id; + protected Long treshold = 10L; + protected ObjectMapper objectMapper; + protected boolean partialFitAllowed = false; + protected boolean alwaysKeepData = true; + + public BaseKernel(String id) { + this.id = id; + objectMapper = new ObjectMapper(); + } + + + @Override + public void setId(String id) { + this.id = id; + } + + + //list, label + protected List, String>> data = new ArrayList<>(); + + + @Override + public void fit() { + fit(this.data); + } + + @Override + public void setTreshold(Long treshold) { + this.treshold = treshold; + } + + @Override + public boolean readyToPredict() { + return data.size() > treshold; + } + + @Override + public void update(List, String>> data) { + } + + @Override + public boolean isPartialFitAllowed() { + return partialFitAllowed; + } + + @Override + public void updateSingle(List features, String label) { + data.add(new Pair<>(features, label)); + } + + @Override + public boolean isAlwaysKeepData() { + return alwaysKeepData; + } + + @Override + public void setAlwaysKeepData(boolean alwaysKeepData) { + this.alwaysKeepData = alwaysKeepData; + } + + @Override + public void save(BehaivStorage storage) throws IOException { + + try (final BufferedWriter writer = new BufferedWriter(new FileWriter(storage.getDataFile(id)))) { + writer.write(objectMapper.writeValueAsString(data)); + } + } + + @Override + public void restore(BehaivStorage storage) throws IOException { + final TypeReference, String>>> typeReference = new TypeReference, String>>>() { + }; + try (final BufferedReader reader = new BufferedReader(new FileReader(storage.getDataFile(id)))) { + final String content = reader.readLine(); + if (content == null || content.isEmpty()) { + data = new ArrayList<>(); + } else { + data = objectMapper.readValue(content, typeReference); + } + } + } +} diff --git a/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java b/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java index ec414f5..b2db896 100644 --- a/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java +++ b/src/main/java/de/dmi3y/behaiv/kernel/Kernel.java @@ -1,95 +1,37 @@ package de.dmi3y.behaiv.kernel; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; import de.dmi3y.behaiv.storage.BehaivStorage; import de.dmi3y.behaiv.tools.Pair; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.FileReader; -import java.io.FileWriter; import java.io.IOException; -import java.util.ArrayList; import java.util.List; -public abstract class Kernel { +public interface Kernel { + void setId(String id); - protected String id; - protected Long treshold = 10L; - protected ObjectMapper objectMapper; - protected boolean partialFitAllowed = false; - protected boolean alwaysKeepData = true; + boolean isEmpty(); - public Kernel(String id) { - this.id = id; - objectMapper = new ObjectMapper(); - } + void fit(List, String>> data); + void fit(); - public void setId(String id) { - this.id = id; - } + void setTreshold(Long treshold); + boolean readyToPredict(); - //list, label - protected List, String>> data = new ArrayList<>(); + void update(List, String>> data); + boolean isPartialFitAllowed(); - public abstract boolean isEmpty(); + void updateSingle(List features, String label); - public abstract void fit(List, String>> data); + String predictOne(List features); - public void fit() { - fit(this.data); - } + boolean isAlwaysKeepData(); - public void setTreshold(Long treshold) { - this.treshold = treshold; - } + void setAlwaysKeepData(boolean alwaysKeepData); - public boolean readyToPredict() { - return data.size() > treshold; - } + void save(BehaivStorage storage) throws IOException; - public void update(List, String>> data) { - } - - public boolean isPartialFitAllowed() { - return partialFitAllowed; - } - - public void updateSingle(List features, String label) { - data.add(new Pair<>(features, label)); - } - - public abstract String predictOne(List features); - - public boolean isAlwaysKeepData() { - return alwaysKeepData; - } - - public void setAlwaysKeepData(boolean alwaysKeepData) { - this.alwaysKeepData = alwaysKeepData; - } - - public void save(BehaivStorage storage) throws IOException { - - try (final BufferedWriter writer = new BufferedWriter(new FileWriter(storage.getDataFile(id)))) { - writer.write(objectMapper.writeValueAsString(data)); - } - } - - public void restore(BehaivStorage storage) throws IOException { - final TypeReference, String>>> typeReference = new TypeReference, String>>>() { - }; - try (final BufferedReader reader = new BufferedReader(new FileReader(storage.getDataFile(id)))) { - final String content = reader.readLine(); - if (content == null || content.isEmpty()) { - data = new ArrayList<>(); - } else { - data = objectMapper.readValue(content, typeReference); - } - } - } + void restore(BehaivStorage storage) throws IOException; } diff --git a/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java b/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java index 5205d25..3337192 100644 --- a/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java +++ b/src/main/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernel.java @@ -17,7 +17,7 @@ import static de.dmi3y.behaiv.tools.DataMappingUtils.toDistinctListOfPairValues; import static de.dmi3y.behaiv.tools.DataMappingUtils.toInput2dArray; -public class LogisticRegressionKernel extends Kernel { +public class LogisticRegressionKernel extends BaseKernel { protected List labels = new ArrayList<>(); private Random rand; diff --git a/src/test/java/de/dmi3y/behaiv/BehaivTest.java b/src/test/java/de/dmi3y/behaiv/BehaivTest.java index 9c9091b..354eea4 100644 --- a/src/test/java/de/dmi3y/behaiv/BehaivTest.java +++ b/src/test/java/de/dmi3y/behaiv/BehaivTest.java @@ -1,5 +1,6 @@ package de.dmi3y.behaiv; +import de.dmi3y.behaiv.kernel.BaseKernel; import de.dmi3y.behaiv.kernel.Kernel; import de.dmi3y.behaiv.kernel.LogisticRegressionKernel; import de.dmi3y.behaiv.provider.DayTimeProvider; @@ -59,7 +60,7 @@ public void stopCapturing_whenDiscard_sessionShouldBeNull() { @Test public void startCapturing_tryToRestore_restoreNetwork() throws IOException { - final Kernel mockKernel = mock(Kernel.class); + final Kernel mockKernel = mock(BaseKernel.class); final BehaivStorage storage = mock(BehaivStorage.class); final Behaiv behaiv = new Behaiv.Builder("testId") .setKernel(mockKernel) @@ -75,7 +76,7 @@ public void startCapturing_tryToRestore_restoreNetwork() throws IOException { @Test public void startCapturing_withIOException_continueWithoutSaving() throws IOException { - final Kernel testKernel = mock(Kernel.class); + final Kernel testKernel = mock(BaseKernel.class); final BehaivStorage storage = mock(BehaivStorage.class); final Behaiv behaiv = Behaiv.with("testId") .setKernel(testKernel) From 36a69de9868c9bc10a82397a2892e7a99ea06ba7 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 4 Apr 2020 12:23:04 +0300 Subject: [PATCH 12/23] Changed proto type to lite --- proto.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto.sh b/proto.sh index d4ba801..946d959 100755 --- a/proto.sh +++ b/proto.sh @@ -1 +1 @@ - protoc -I=. --java_out=./src/main/java ./behaiv.proto \ No newline at end of file + protoc -I=. --java_out:lite=./src/main/java ./behaiv.proto \ No newline at end of file From d08c1478e70ec25adb5532af4c3fea935bdc3d23 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 4 Apr 2020 12:23:21 +0300 Subject: [PATCH 13/23] Changed protobuf dependency type to lite --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index cec6e41..6145c76 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ repositories { dependencies { // Protobuf - compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.11.4' + compile group: 'com.google.protobuf', name: 'protobuf-javalite', version: '3.11.4' // Swagger codegen dependencies swaggerCodegen 'io.swagger:swagger-codegen-cli:2.4.2' // Swagger Codegen V2 // This dependency is exported to consumers, that is to say found on their compile classpath. From c59bdc41c29e2acffcb6b94703b1c5267c61368b Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 4 Apr 2020 12:24:14 +0300 Subject: [PATCH 14/23] fixed incorrect protoc command --- proto.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto.sh b/proto.sh index 946d959..631e20f 100755 --- a/proto.sh +++ b/proto.sh @@ -1 +1 @@ - protoc -I=. --java_out:lite=./src/main/java ./behaiv.proto \ No newline at end of file + protoc -I=. --java_out=lite:./src/main/java ./behaiv.proto \ No newline at end of file From 8013139be9cbc6114031ee19887efe070710d706 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 4 Apr 2020 12:31:44 +0300 Subject: [PATCH 15/23] Added proto files --- .../java/tech/donau/behaiv/proto/Action.java | 953 ++++++++++++++++++ .../donau/behaiv/proto/ActionOrBuilder.java | 114 +++ .../java/tech/donau/behaiv/proto/Behaiv.java | 16 + .../java/tech/donau/behaiv/proto/Data.java | 350 +++++++ .../donau/behaiv/proto/DataOrBuilder.java | 27 + .../tech/donau/behaiv/proto/Prediction.java | 513 ++++++++++ .../behaiv/proto/PredictionOrBuilder.java | 35 + .../donau/behaiv/proto/PredictionSet.java | 465 +++++++++ .../behaiv/proto/PredictionSetOrBuilder.java | 29 + .../java/tech/donau/behaiv/proto/Screen.java | 342 +++++++ .../donau/behaiv/proto/ScreenOrBuilder.java | 27 + 11 files changed, 2871 insertions(+) create mode 100644 src/main/java/tech/donau/behaiv/proto/Action.java create mode 100644 src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java create mode 100644 src/main/java/tech/donau/behaiv/proto/Behaiv.java create mode 100644 src/main/java/tech/donau/behaiv/proto/Data.java create mode 100644 src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java create mode 100644 src/main/java/tech/donau/behaiv/proto/Prediction.java create mode 100644 src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java create mode 100644 src/main/java/tech/donau/behaiv/proto/PredictionSet.java create mode 100644 src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java create mode 100644 src/main/java/tech/donau/behaiv/proto/Screen.java create mode 100644 src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java diff --git a/src/main/java/tech/donau/behaiv/proto/Action.java b/src/main/java/tech/donau/behaiv/proto/Action.java new file mode 100644 index 0000000..297ac36 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/Action.java @@ -0,0 +1,953 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +/** + *
+ * Communication messages
+ * 
+ * + * Protobuf type {@code Action} + */ +public final class Action extends + com.google.protobuf.GeneratedMessageLite< + Action, Action.Builder> implements + // @@protoc_insertion_point(message_implements:Action) + ActionOrBuilder { + private Action() { + action_ = ""; + object_ = ""; + screenStack_ = emptyIntList(); + } + public static final int LOCAL_ID_FIELD_NUMBER = 1; + private long localId_; + /** + * int64 local_id = 1; + * @return The localId. + */ + @java.lang.Override + public long getLocalId() { + return localId_; + } + /** + * int64 local_id = 1; + * @param value The localId to set. + */ + private void setLocalId(long value) { + + localId_ = value; + } + /** + * int64 local_id = 1; + */ + private void clearLocalId() { + + localId_ = 0L; + } + + public static final int PREV_LOCAL_ID_FIELD_NUMBER = 2; + private long prevLocalId_; + /** + * int64 prev_local_id = 2; + * @return The prevLocalId. + */ + @java.lang.Override + public long getPrevLocalId() { + return prevLocalId_; + } + /** + * int64 prev_local_id = 2; + * @param value The prevLocalId to set. + */ + private void setPrevLocalId(long value) { + + prevLocalId_ = value; + } + /** + * int64 prev_local_id = 2; + */ + private void clearPrevLocalId() { + + prevLocalId_ = 0L; + } + + public static final int ACTION_FIELD_NUMBER = 3; + private java.lang.String action_; + /** + * string action = 3; + * @return The action. + */ + @java.lang.Override + public java.lang.String getAction() { + return action_; + } + /** + * string action = 3; + * @return The bytes for action. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getActionBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(action_); + } + /** + * string action = 3; + * @param value The action to set. + */ + private void setAction( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + action_ = value; + } + /** + * string action = 3; + */ + private void clearAction() { + + action_ = getDefaultInstance().getAction(); + } + /** + * string action = 3; + * @param value The bytes for action to set. + */ + private void setActionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + action_ = value.toStringUtf8(); + } + + public static final int OBJECT_FIELD_NUMBER = 4; + private java.lang.String object_; + /** + * string object = 4; + * @return The object. + */ + @java.lang.Override + public java.lang.String getObject() { + return object_; + } + /** + * string object = 4; + * @return The bytes for object. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getObjectBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(object_); + } + /** + * string object = 4; + * @param value The object to set. + */ + private void setObject( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + object_ = value; + } + /** + * string object = 4; + */ + private void clearObject() { + + object_ = getDefaultInstance().getObject(); + } + /** + * string object = 4; + * @param value The bytes for object to set. + */ + private void setObjectBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + object_ = value.toStringUtf8(); + } + + public static final int CURRENT_SCREEN_ID_FIELD_NUMBER = 5; + private int currentScreenId_; + /** + * int32 current_screen_id = 5; + * @return The currentScreenId. + */ + @java.lang.Override + public int getCurrentScreenId() { + return currentScreenId_; + } + /** + * int32 current_screen_id = 5; + * @param value The currentScreenId to set. + */ + private void setCurrentScreenId(int value) { + + currentScreenId_ = value; + } + /** + * int32 current_screen_id = 5; + */ + private void clearCurrentScreenId() { + + currentScreenId_ = 0; + } + + public static final int SCREEN_STACK_FIELD_NUMBER = 6; + private com.google.protobuf.Internal.IntList screenStack_; + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @return A list containing the screenStack. + */ + @java.lang.Override + public java.util.List + getScreenStackList() { + return screenStack_; + } + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @return The count of screenStack. + */ + @java.lang.Override + public int getScreenStackCount() { + return screenStack_.size(); + } + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @param index The index of the element to return. + * @return The screenStack at the given index. + */ + @java.lang.Override + public int getScreenStack(int index) { + return screenStack_.getInt(index); + } + private int screenStackMemoizedSerializedSize = -1; + private void ensureScreenStackIsMutable() { + if (!screenStack_.isModifiable()) { + screenStack_ = + com.google.protobuf.GeneratedMessageLite.mutableCopy(screenStack_); + } + } + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @param index The index to set the value at. + * @param value The screenStack to set. + */ + private void setScreenStack( + int index, int value) { + ensureScreenStackIsMutable(); + screenStack_.setInt(index, value); + } + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @param value The screenStack to add. + */ + private void addScreenStack(int value) { + ensureScreenStackIsMutable(); + screenStack_.addInt(value); + } + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @param values The screenStack to add. + */ + private void addAllScreenStack( + java.lang.Iterable values) { + ensureScreenStackIsMutable(); + com.google.protobuf.AbstractMessageLite.addAll( + values, screenStack_); + } + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + */ + private void clearScreenStack() { + screenStack_ = emptyIntList(); + } + + public static final int ATTRIBUTES_FIELD_NUMBER = 8; + private static final class AttributesDefaultEntryHolder { + static final com.google.protobuf.MapEntryLite< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntryLite + .newDefaultInstance( + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + private com.google.protobuf.MapFieldLite< + java.lang.String, java.lang.String> attributes_ = + com.google.protobuf.MapFieldLite.emptyMapField(); + private com.google.protobuf.MapFieldLite + internalGetAttributes() { + return attributes_; + } + private com.google.protobuf.MapFieldLite + internalGetMutableAttributes() { + if (!attributes_.isMutable()) { + attributes_ = attributes_.mutableCopy(); + } + return attributes_; + } + @java.lang.Override + + public int getAttributesCount() { + return internalGetAttributes().size(); + } + /** + * map<string, string> attributes = 8; + */ + @java.lang.Override + + public boolean containsAttributes( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + return internalGetAttributes().containsKey(key); + } + /** + * Use {@link #getAttributesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAttributes() { + return getAttributesMap(); + } + /** + * map<string, string> attributes = 8; + */ + @java.lang.Override + + public java.util.Map getAttributesMap() { + return java.util.Collections.unmodifiableMap( + internalGetAttributes()); + } + /** + * map<string, string> attributes = 8; + */ + @java.lang.Override + + public java.lang.String getAttributesOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetAttributes(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, string> attributes = 8; + */ + @java.lang.Override + + public java.lang.String getAttributesOrThrow( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetAttributes(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + /** + * map<string, string> attributes = 8; + */ + private java.util.Map + getMutableAttributesMap() { + return internalGetMutableAttributes(); + } + + public static tech.donau.behaiv.proto.Action parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Action parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Action parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Action parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Action parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Action parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Action parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Action parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static tech.donau.behaiv.proto.Action parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Action parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static tech.donau.behaiv.proto.Action parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Action parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(tech.donau.behaiv.proto.Action prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + *
+   * Communication messages
+   * 
+ * + * Protobuf type {@code Action} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + tech.donau.behaiv.proto.Action, Builder> implements + // @@protoc_insertion_point(builder_implements:Action) + tech.donau.behaiv.proto.ActionOrBuilder { + // Construct using tech.donau.behaiv.proto.Action.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * int64 local_id = 1; + * @return The localId. + */ + @java.lang.Override + public long getLocalId() { + return instance.getLocalId(); + } + /** + * int64 local_id = 1; + * @param value The localId to set. + * @return This builder for chaining. + */ + public Builder setLocalId(long value) { + copyOnWrite(); + instance.setLocalId(value); + return this; + } + /** + * int64 local_id = 1; + * @return This builder for chaining. + */ + public Builder clearLocalId() { + copyOnWrite(); + instance.clearLocalId(); + return this; + } + + /** + * int64 prev_local_id = 2; + * @return The prevLocalId. + */ + @java.lang.Override + public long getPrevLocalId() { + return instance.getPrevLocalId(); + } + /** + * int64 prev_local_id = 2; + * @param value The prevLocalId to set. + * @return This builder for chaining. + */ + public Builder setPrevLocalId(long value) { + copyOnWrite(); + instance.setPrevLocalId(value); + return this; + } + /** + * int64 prev_local_id = 2; + * @return This builder for chaining. + */ + public Builder clearPrevLocalId() { + copyOnWrite(); + instance.clearPrevLocalId(); + return this; + } + + /** + * string action = 3; + * @return The action. + */ + @java.lang.Override + public java.lang.String getAction() { + return instance.getAction(); + } + /** + * string action = 3; + * @return The bytes for action. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getActionBytes() { + return instance.getActionBytes(); + } + /** + * string action = 3; + * @param value The action to set. + * @return This builder for chaining. + */ + public Builder setAction( + java.lang.String value) { + copyOnWrite(); + instance.setAction(value); + return this; + } + /** + * string action = 3; + * @return This builder for chaining. + */ + public Builder clearAction() { + copyOnWrite(); + instance.clearAction(); + return this; + } + /** + * string action = 3; + * @param value The bytes for action to set. + * @return This builder for chaining. + */ + public Builder setActionBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setActionBytes(value); + return this; + } + + /** + * string object = 4; + * @return The object. + */ + @java.lang.Override + public java.lang.String getObject() { + return instance.getObject(); + } + /** + * string object = 4; + * @return The bytes for object. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getObjectBytes() { + return instance.getObjectBytes(); + } + /** + * string object = 4; + * @param value The object to set. + * @return This builder for chaining. + */ + public Builder setObject( + java.lang.String value) { + copyOnWrite(); + instance.setObject(value); + return this; + } + /** + * string object = 4; + * @return This builder for chaining. + */ + public Builder clearObject() { + copyOnWrite(); + instance.clearObject(); + return this; + } + /** + * string object = 4; + * @param value The bytes for object to set. + * @return This builder for chaining. + */ + public Builder setObjectBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setObjectBytes(value); + return this; + } + + /** + * int32 current_screen_id = 5; + * @return The currentScreenId. + */ + @java.lang.Override + public int getCurrentScreenId() { + return instance.getCurrentScreenId(); + } + /** + * int32 current_screen_id = 5; + * @param value The currentScreenId to set. + * @return This builder for chaining. + */ + public Builder setCurrentScreenId(int value) { + copyOnWrite(); + instance.setCurrentScreenId(value); + return this; + } + /** + * int32 current_screen_id = 5; + * @return This builder for chaining. + */ + public Builder clearCurrentScreenId() { + copyOnWrite(); + instance.clearCurrentScreenId(); + return this; + } + + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @return A list containing the screenStack. + */ + @java.lang.Override + public java.util.List + getScreenStackList() { + return java.util.Collections.unmodifiableList( + instance.getScreenStackList()); + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @return The count of screenStack. + */ + @java.lang.Override + public int getScreenStackCount() { + return instance.getScreenStackCount(); + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @param index The index of the element to return. + * @return The screenStack at the given index. + */ + @java.lang.Override + public int getScreenStack(int index) { + return instance.getScreenStack(index); + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @param value The screenStack to set. + * @return This builder for chaining. + */ + public Builder setScreenStack( + int index, int value) { + copyOnWrite(); + instance.setScreenStack(index, value); + return this; + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @param value The screenStack to add. + * @return This builder for chaining. + */ + public Builder addScreenStack(int value) { + copyOnWrite(); + instance.addScreenStack(value); + return this; + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @param values The screenStack to add. + * @return This builder for chaining. + */ + public Builder addAllScreenStack( + java.lang.Iterable values) { + copyOnWrite(); + instance.addAllScreenStack(values); + return this; + } + /** + *
+     *    repeated Event events = 7; TODO
+     * 
+ * + * repeated int32 screen_stack = 6; + * @return This builder for chaining. + */ + public Builder clearScreenStack() { + copyOnWrite(); + instance.clearScreenStack(); + return this; + } + + @java.lang.Override + + public int getAttributesCount() { + return instance.getAttributesMap().size(); + } + /** + * map<string, string> attributes = 8; + */ + @java.lang.Override + + public boolean containsAttributes( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + return instance.getAttributesMap().containsKey(key); + } + + public Builder clearAttributes() { + copyOnWrite(); + instance.getMutableAttributesMap().clear(); + return this; + } + /** + * map<string, string> attributes = 8; + */ + + public Builder removeAttributes( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + copyOnWrite(); + instance.getMutableAttributesMap().remove(key); + return this; + } + /** + * Use {@link #getAttributesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAttributes() { + return getAttributesMap(); + } + /** + * map<string, string> attributes = 8; + */ + @java.lang.Override + public java.util.Map getAttributesMap() { + return java.util.Collections.unmodifiableMap( + instance.getAttributesMap()); + } + /** + * map<string, string> attributes = 8; + */ + @java.lang.Override + + public java.lang.String getAttributesOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + instance.getAttributesMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, string> attributes = 8; + */ + @java.lang.Override + + public java.lang.String getAttributesOrThrow( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + instance.getAttributesMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + /** + * map<string, string> attributes = 8; + */ + public Builder putAttributes( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new java.lang.NullPointerException(); } + if (value == null) { throw new java.lang.NullPointerException(); } + copyOnWrite(); + instance.getMutableAttributesMap().put(key, value); + return this; + } + /** + * map<string, string> attributes = 8; + */ + public Builder putAllAttributes( + java.util.Map values) { + copyOnWrite(); + instance.getMutableAttributesMap().putAll(values); + return this; + } + + // @@protoc_insertion_point(builder_scope:Action) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new tech.donau.behaiv.proto.Action(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "localId_", + "prevLocalId_", + "action_", + "object_", + "currentScreenId_", + "screenStack_", + "attributes_", + AttributesDefaultEntryHolder.defaultEntry, + }; + java.lang.String info = + "\u0000\u0007\u0000\u0000\u0001\b\u0007\u0001\u0001\u0000\u0001\u0002\u0002\u0002" + + "\u0003\u0208\u0004\u0208\u0005\u0004\u0006\'\b2"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (tech.donau.behaiv.proto.Action.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:Action) + private static final tech.donau.behaiv.proto.Action DEFAULT_INSTANCE; + static { + Action defaultInstance = new Action(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + Action.class, defaultInstance); + } + + public static tech.donau.behaiv.proto.Action getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } +} + diff --git a/src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java new file mode 100644 index 0000000..e15a944 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/ActionOrBuilder.java @@ -0,0 +1,114 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public interface ActionOrBuilder extends + // @@protoc_insertion_point(interface_extends:Action) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * int64 local_id = 1; + * @return The localId. + */ + long getLocalId(); + + /** + * int64 prev_local_id = 2; + * @return The prevLocalId. + */ + long getPrevLocalId(); + + /** + * string action = 3; + * @return The action. + */ + java.lang.String getAction(); + /** + * string action = 3; + * @return The bytes for action. + */ + com.google.protobuf.ByteString + getActionBytes(); + + /** + * string object = 4; + * @return The object. + */ + java.lang.String getObject(); + /** + * string object = 4; + * @return The bytes for object. + */ + com.google.protobuf.ByteString + getObjectBytes(); + + /** + * int32 current_screen_id = 5; + * @return The currentScreenId. + */ + int getCurrentScreenId(); + + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @return A list containing the screenStack. + */ + java.util.List getScreenStackList(); + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @return The count of screenStack. + */ + int getScreenStackCount(); + /** + *
+   *    repeated Event events = 7; TODO
+   * 
+ * + * repeated int32 screen_stack = 6; + * @param index The index of the element to return. + * @return The screenStack at the given index. + */ + int getScreenStack(int index); + + /** + * map<string, string> attributes = 8; + */ + int getAttributesCount(); + /** + * map<string, string> attributes = 8; + */ + boolean containsAttributes( + java.lang.String key); + /** + * Use {@link #getAttributesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getAttributes(); + /** + * map<string, string> attributes = 8; + */ + java.util.Map + getAttributesMap(); + /** + * map<string, string> attributes = 8; + */ + + java.lang.String getAttributesOrDefault( + java.lang.String key, + java.lang.String defaultValue); + /** + * map<string, string> attributes = 8; + */ + + java.lang.String getAttributesOrThrow( + java.lang.String key); +} diff --git a/src/main/java/tech/donau/behaiv/proto/Behaiv.java b/src/main/java/tech/donau/behaiv/proto/Behaiv.java new file mode 100644 index 0000000..7089d28 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/Behaiv.java @@ -0,0 +1,16 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public final class Behaiv { + private Behaiv() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + static { + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/tech/donau/behaiv/proto/Data.java b/src/main/java/tech/donau/behaiv/proto/Data.java new file mode 100644 index 0000000..68b09d8 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/Data.java @@ -0,0 +1,350 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +/** + *
+ * Data messages
+ * 
+ * + * Protobuf type {@code Data} + */ +public final class Data extends + com.google.protobuf.GeneratedMessageLite< + Data, Data.Builder> implements + // @@protoc_insertion_point(message_implements:Data) + DataOrBuilder { + private Data() { + key_ = ""; + } + public static final int KEY_FIELD_NUMBER = 2; + private java.lang.String key_; + /** + * string key = 2; + * @return The key. + */ + @java.lang.Override + public java.lang.String getKey() { + return key_; + } + /** + * string key = 2; + * @return The bytes for key. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getKeyBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(key_); + } + /** + * string key = 2; + * @param value The key to set. + */ + private void setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + } + /** + * string key = 2; + */ + private void clearKey() { + + key_ = getDefaultInstance().getKey(); + } + /** + * string key = 2; + * @param value The bytes for key to set. + */ + private void setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value.toStringUtf8(); + } + + public static final int VALUE_FIELD_NUMBER = 3; + private double value_; + /** + * double value = 3; + * @return The value. + */ + @java.lang.Override + public double getValue() { + return value_; + } + /** + * double value = 3; + * @param value The value to set. + */ + private void setValue(double value) { + + value_ = value; + } + /** + * double value = 3; + */ + private void clearValue() { + + value_ = 0D; + } + + public static tech.donau.behaiv.proto.Data parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Data parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Data parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Data parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Data parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Data parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Data parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Data parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static tech.donau.behaiv.proto.Data parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Data parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static tech.donau.behaiv.proto.Data parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Data parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(tech.donau.behaiv.proto.Data prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + *
+   * Data messages
+   * 
+ * + * Protobuf type {@code Data} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + tech.donau.behaiv.proto.Data, Builder> implements + // @@protoc_insertion_point(builder_implements:Data) + tech.donau.behaiv.proto.DataOrBuilder { + // Construct using tech.donau.behaiv.proto.Data.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * string key = 2; + * @return The key. + */ + @java.lang.Override + public java.lang.String getKey() { + return instance.getKey(); + } + /** + * string key = 2; + * @return The bytes for key. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getKeyBytes() { + return instance.getKeyBytes(); + } + /** + * string key = 2; + * @param value The key to set. + * @return This builder for chaining. + */ + public Builder setKey( + java.lang.String value) { + copyOnWrite(); + instance.setKey(value); + return this; + } + /** + * string key = 2; + * @return This builder for chaining. + */ + public Builder clearKey() { + copyOnWrite(); + instance.clearKey(); + return this; + } + /** + * string key = 2; + * @param value The bytes for key to set. + * @return This builder for chaining. + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setKeyBytes(value); + return this; + } + + /** + * double value = 3; + * @return The value. + */ + @java.lang.Override + public double getValue() { + return instance.getValue(); + } + /** + * double value = 3; + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue(double value) { + copyOnWrite(); + instance.setValue(value); + return this; + } + /** + * double value = 3; + * @return This builder for chaining. + */ + public Builder clearValue() { + copyOnWrite(); + instance.clearValue(); + return this; + } + + // @@protoc_insertion_point(builder_scope:Data) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new tech.donau.behaiv.proto.Data(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "key_", + "value_", + }; + java.lang.String info = + "\u0000\u0002\u0000\u0000\u0002\u0003\u0002\u0000\u0000\u0000\u0002\u0208\u0003\u0000" + + ""; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (tech.donau.behaiv.proto.Data.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:Data) + private static final tech.donau.behaiv.proto.Data DEFAULT_INSTANCE; + static { + Data defaultInstance = new Data(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + Data.class, defaultInstance); + } + + public static tech.donau.behaiv.proto.Data getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } +} + diff --git a/src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java new file mode 100644 index 0000000..77f1b93 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/DataOrBuilder.java @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public interface DataOrBuilder extends + // @@protoc_insertion_point(interface_extends:Data) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * string key = 2; + * @return The key. + */ + java.lang.String getKey(); + /** + * string key = 2; + * @return The bytes for key. + */ + com.google.protobuf.ByteString + getKeyBytes(); + + /** + * double value = 3; + * @return The value. + */ + double getValue(); +} diff --git a/src/main/java/tech/donau/behaiv/proto/Prediction.java b/src/main/java/tech/donau/behaiv/proto/Prediction.java new file mode 100644 index 0000000..6283d78 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/Prediction.java @@ -0,0 +1,513 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +/** + * Protobuf type {@code Prediction} + */ +public final class Prediction extends + com.google.protobuf.GeneratedMessageLite< + Prediction, Prediction.Builder> implements + // @@protoc_insertion_point(message_implements:Prediction) + PredictionOrBuilder { + private Prediction() { + data_ = emptyProtobufList(); + label_ = ""; + } + public static final int DATA_FIELD_NUMBER = 1; + private com.google.protobuf.Internal.ProtobufList data_; + /** + * repeated .Data data = 1; + */ + @java.lang.Override + public java.util.List getDataList() { + return data_; + } + /** + * repeated .Data data = 1; + */ + public java.util.List + getDataOrBuilderList() { + return data_; + } + /** + * repeated .Data data = 1; + */ + @java.lang.Override + public int getDataCount() { + return data_.size(); + } + /** + * repeated .Data data = 1; + */ + @java.lang.Override + public tech.donau.behaiv.proto.Data getData(int index) { + return data_.get(index); + } + /** + * repeated .Data data = 1; + */ + public tech.donau.behaiv.proto.DataOrBuilder getDataOrBuilder( + int index) { + return data_.get(index); + } + private void ensureDataIsMutable() { + if (!data_.isModifiable()) { + data_ = + com.google.protobuf.GeneratedMessageLite.mutableCopy(data_); + } + } + + /** + * repeated .Data data = 1; + */ + private void setData( + int index, tech.donau.behaiv.proto.Data value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDataIsMutable(); + data_.set(index, value); + } + /** + * repeated .Data data = 1; + */ + private void setData( + int index, tech.donau.behaiv.proto.Data.Builder builderForValue) { + ensureDataIsMutable(); + data_.set(index, builderForValue.build()); + } + /** + * repeated .Data data = 1; + */ + private void addData(tech.donau.behaiv.proto.Data value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDataIsMutable(); + data_.add(value); + } + /** + * repeated .Data data = 1; + */ + private void addData( + int index, tech.donau.behaiv.proto.Data value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDataIsMutable(); + data_.add(index, value); + } + /** + * repeated .Data data = 1; + */ + private void addData( + tech.donau.behaiv.proto.Data.Builder builderForValue) { + ensureDataIsMutable(); + data_.add(builderForValue.build()); + } + /** + * repeated .Data data = 1; + */ + private void addData( + int index, tech.donau.behaiv.proto.Data.Builder builderForValue) { + ensureDataIsMutable(); + data_.add(index, builderForValue.build()); + } + /** + * repeated .Data data = 1; + */ + private void addAllData( + java.lang.Iterable values) { + ensureDataIsMutable(); + com.google.protobuf.AbstractMessageLite.addAll( + values, data_); + } + /** + * repeated .Data data = 1; + */ + private void clearData() { + data_ = emptyProtobufList(); + } + /** + * repeated .Data data = 1; + */ + private void removeData(int index) { + ensureDataIsMutable(); + data_.remove(index); + } + + public static final int LABEL_FIELD_NUMBER = 2; + private java.lang.String label_; + /** + * string label = 2; + * @return The label. + */ + @java.lang.Override + public java.lang.String getLabel() { + return label_; + } + /** + * string label = 2; + * @return The bytes for label. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getLabelBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(label_); + } + /** + * string label = 2; + * @param value The label to set. + */ + private void setLabel( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + label_ = value; + } + /** + * string label = 2; + */ + private void clearLabel() { + + label_ = getDefaultInstance().getLabel(); + } + /** + * string label = 2; + * @param value The bytes for label to set. + */ + private void setLabelBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + label_ = value.toStringUtf8(); + } + + public static tech.donau.behaiv.proto.Prediction parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Prediction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Prediction parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static tech.donau.behaiv.proto.Prediction parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Prediction parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Prediction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(tech.donau.behaiv.proto.Prediction prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code Prediction} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + tech.donau.behaiv.proto.Prediction, Builder> implements + // @@protoc_insertion_point(builder_implements:Prediction) + tech.donau.behaiv.proto.PredictionOrBuilder { + // Construct using tech.donau.behaiv.proto.Prediction.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * repeated .Data data = 1; + */ + @java.lang.Override + public java.util.List getDataList() { + return java.util.Collections.unmodifiableList( + instance.getDataList()); + } + /** + * repeated .Data data = 1; + */ + @java.lang.Override + public int getDataCount() { + return instance.getDataCount(); + }/** + * repeated .Data data = 1; + */ + @java.lang.Override + public tech.donau.behaiv.proto.Data getData(int index) { + return instance.getData(index); + } + /** + * repeated .Data data = 1; + */ + public Builder setData( + int index, tech.donau.behaiv.proto.Data value) { + copyOnWrite(); + instance.setData(index, value); + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder setData( + int index, tech.donau.behaiv.proto.Data.Builder builderForValue) { + copyOnWrite(); + instance.setData(index, builderForValue); + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder addData(tech.donau.behaiv.proto.Data value) { + copyOnWrite(); + instance.addData(value); + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder addData( + int index, tech.donau.behaiv.proto.Data value) { + copyOnWrite(); + instance.addData(index, value); + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder addData( + tech.donau.behaiv.proto.Data.Builder builderForValue) { + copyOnWrite(); + instance.addData(builderForValue); + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder addData( + int index, tech.donau.behaiv.proto.Data.Builder builderForValue) { + copyOnWrite(); + instance.addData(index, builderForValue); + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder addAllData( + java.lang.Iterable values) { + copyOnWrite(); + instance.addAllData(values); + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder clearData() { + copyOnWrite(); + instance.clearData(); + return this; + } + /** + * repeated .Data data = 1; + */ + public Builder removeData(int index) { + copyOnWrite(); + instance.removeData(index); + return this; + } + + /** + * string label = 2; + * @return The label. + */ + @java.lang.Override + public java.lang.String getLabel() { + return instance.getLabel(); + } + /** + * string label = 2; + * @return The bytes for label. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getLabelBytes() { + return instance.getLabelBytes(); + } + /** + * string label = 2; + * @param value The label to set. + * @return This builder for chaining. + */ + public Builder setLabel( + java.lang.String value) { + copyOnWrite(); + instance.setLabel(value); + return this; + } + /** + * string label = 2; + * @return This builder for chaining. + */ + public Builder clearLabel() { + copyOnWrite(); + instance.clearLabel(); + return this; + } + /** + * string label = 2; + * @param value The bytes for label to set. + * @return This builder for chaining. + */ + public Builder setLabelBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setLabelBytes(value); + return this; + } + + // @@protoc_insertion_point(builder_scope:Prediction) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new tech.donau.behaiv.proto.Prediction(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "data_", + tech.donau.behaiv.proto.Data.class, + "label_", + }; + java.lang.String info = + "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0001\u0000\u0001\u001b\u0002\u0208" + + ""; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (tech.donau.behaiv.proto.Prediction.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:Prediction) + private static final tech.donau.behaiv.proto.Prediction DEFAULT_INSTANCE; + static { + Prediction defaultInstance = new Prediction(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + Prediction.class, defaultInstance); + } + + public static tech.donau.behaiv.proto.Prediction getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } +} + diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java new file mode 100644 index 0000000..edddef5 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/PredictionOrBuilder.java @@ -0,0 +1,35 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public interface PredictionOrBuilder extends + // @@protoc_insertion_point(interface_extends:Prediction) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * repeated .Data data = 1; + */ + java.util.List + getDataList(); + /** + * repeated .Data data = 1; + */ + tech.donau.behaiv.proto.Data getData(int index); + /** + * repeated .Data data = 1; + */ + int getDataCount(); + + /** + * string label = 2; + * @return The label. + */ + java.lang.String getLabel(); + /** + * string label = 2; + * @return The bytes for label. + */ + com.google.protobuf.ByteString + getLabelBytes(); +} diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionSet.java b/src/main/java/tech/donau/behaiv/proto/PredictionSet.java new file mode 100644 index 0000000..b9166db --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/PredictionSet.java @@ -0,0 +1,465 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +/** + * Protobuf type {@code PredictionSet} + */ +public final class PredictionSet extends + com.google.protobuf.GeneratedMessageLite< + PredictionSet, PredictionSet.Builder> implements + // @@protoc_insertion_point(message_implements:PredictionSet) + PredictionSetOrBuilder { + private PredictionSet() { + prediction_ = emptyProtobufList(); + } + public static final int PREDICTION_FIELD_NUMBER = 1; + private com.google.protobuf.Internal.ProtobufList prediction_; + /** + * repeated .Prediction prediction = 1; + */ + @java.lang.Override + public java.util.List getPredictionList() { + return prediction_; + } + /** + * repeated .Prediction prediction = 1; + */ + public java.util.List + getPredictionOrBuilderList() { + return prediction_; + } + /** + * repeated .Prediction prediction = 1; + */ + @java.lang.Override + public int getPredictionCount() { + return prediction_.size(); + } + /** + * repeated .Prediction prediction = 1; + */ + @java.lang.Override + public tech.donau.behaiv.proto.Prediction getPrediction(int index) { + return prediction_.get(index); + } + /** + * repeated .Prediction prediction = 1; + */ + public tech.donau.behaiv.proto.PredictionOrBuilder getPredictionOrBuilder( + int index) { + return prediction_.get(index); + } + private void ensurePredictionIsMutable() { + if (!prediction_.isModifiable()) { + prediction_ = + com.google.protobuf.GeneratedMessageLite.mutableCopy(prediction_); + } + } + + /** + * repeated .Prediction prediction = 1; + */ + private void setPrediction( + int index, tech.donau.behaiv.proto.Prediction value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePredictionIsMutable(); + prediction_.set(index, value); + } + /** + * repeated .Prediction prediction = 1; + */ + private void setPrediction( + int index, tech.donau.behaiv.proto.Prediction.Builder builderForValue) { + ensurePredictionIsMutable(); + prediction_.set(index, builderForValue.build()); + } + /** + * repeated .Prediction prediction = 1; + */ + private void addPrediction(tech.donau.behaiv.proto.Prediction value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePredictionIsMutable(); + prediction_.add(value); + } + /** + * repeated .Prediction prediction = 1; + */ + private void addPrediction( + int index, tech.donau.behaiv.proto.Prediction value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePredictionIsMutable(); + prediction_.add(index, value); + } + /** + * repeated .Prediction prediction = 1; + */ + private void addPrediction( + tech.donau.behaiv.proto.Prediction.Builder builderForValue) { + ensurePredictionIsMutable(); + prediction_.add(builderForValue.build()); + } + /** + * repeated .Prediction prediction = 1; + */ + private void addPrediction( + int index, tech.donau.behaiv.proto.Prediction.Builder builderForValue) { + ensurePredictionIsMutable(); + prediction_.add(index, builderForValue.build()); + } + /** + * repeated .Prediction prediction = 1; + */ + private void addAllPrediction( + java.lang.Iterable values) { + ensurePredictionIsMutable(); + com.google.protobuf.AbstractMessageLite.addAll( + values, prediction_); + } + /** + * repeated .Prediction prediction = 1; + */ + private void clearPrediction() { + prediction_ = emptyProtobufList(); + } + /** + * repeated .Prediction prediction = 1; + */ + private void removePrediction(int index) { + ensurePredictionIsMutable(); + prediction_.remove(index); + } + + public static final int DYNAMICCOLUMNS_FIELD_NUMBER = 2; + private boolean dynamicColumns_; + /** + * bool dynamicColumns = 2; + * @return The dynamicColumns. + */ + @java.lang.Override + public boolean getDynamicColumns() { + return dynamicColumns_; + } + /** + * bool dynamicColumns = 2; + * @param value The dynamicColumns to set. + */ + private void setDynamicColumns(boolean value) { + + dynamicColumns_ = value; + } + /** + * bool dynamicColumns = 2; + */ + private void clearDynamicColumns() { + + dynamicColumns_ = false; + } + + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static tech.donau.behaiv.proto.PredictionSet parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.PredictionSet parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.PredictionSet parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(tech.donau.behaiv.proto.PredictionSet prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code PredictionSet} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + tech.donau.behaiv.proto.PredictionSet, Builder> implements + // @@protoc_insertion_point(builder_implements:PredictionSet) + tech.donau.behaiv.proto.PredictionSetOrBuilder { + // Construct using tech.donau.behaiv.proto.PredictionSet.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * repeated .Prediction prediction = 1; + */ + @java.lang.Override + public java.util.List getPredictionList() { + return java.util.Collections.unmodifiableList( + instance.getPredictionList()); + } + /** + * repeated .Prediction prediction = 1; + */ + @java.lang.Override + public int getPredictionCount() { + return instance.getPredictionCount(); + }/** + * repeated .Prediction prediction = 1; + */ + @java.lang.Override + public tech.donau.behaiv.proto.Prediction getPrediction(int index) { + return instance.getPrediction(index); + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder setPrediction( + int index, tech.donau.behaiv.proto.Prediction value) { + copyOnWrite(); + instance.setPrediction(index, value); + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder setPrediction( + int index, tech.donau.behaiv.proto.Prediction.Builder builderForValue) { + copyOnWrite(); + instance.setPrediction(index, builderForValue); + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder addPrediction(tech.donau.behaiv.proto.Prediction value) { + copyOnWrite(); + instance.addPrediction(value); + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder addPrediction( + int index, tech.donau.behaiv.proto.Prediction value) { + copyOnWrite(); + instance.addPrediction(index, value); + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder addPrediction( + tech.donau.behaiv.proto.Prediction.Builder builderForValue) { + copyOnWrite(); + instance.addPrediction(builderForValue); + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder addPrediction( + int index, tech.donau.behaiv.proto.Prediction.Builder builderForValue) { + copyOnWrite(); + instance.addPrediction(index, builderForValue); + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder addAllPrediction( + java.lang.Iterable values) { + copyOnWrite(); + instance.addAllPrediction(values); + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder clearPrediction() { + copyOnWrite(); + instance.clearPrediction(); + return this; + } + /** + * repeated .Prediction prediction = 1; + */ + public Builder removePrediction(int index) { + copyOnWrite(); + instance.removePrediction(index); + return this; + } + + /** + * bool dynamicColumns = 2; + * @return The dynamicColumns. + */ + @java.lang.Override + public boolean getDynamicColumns() { + return instance.getDynamicColumns(); + } + /** + * bool dynamicColumns = 2; + * @param value The dynamicColumns to set. + * @return This builder for chaining. + */ + public Builder setDynamicColumns(boolean value) { + copyOnWrite(); + instance.setDynamicColumns(value); + return this; + } + /** + * bool dynamicColumns = 2; + * @return This builder for chaining. + */ + public Builder clearDynamicColumns() { + copyOnWrite(); + instance.clearDynamicColumns(); + return this; + } + + // @@protoc_insertion_point(builder_scope:PredictionSet) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new tech.donau.behaiv.proto.PredictionSet(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "prediction_", + tech.donau.behaiv.proto.Prediction.class, + "dynamicColumns_", + }; + java.lang.String info = + "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0001\u0000\u0001\u001b\u0002\u0007" + + ""; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (tech.donau.behaiv.proto.PredictionSet.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:PredictionSet) + private static final tech.donau.behaiv.proto.PredictionSet DEFAULT_INSTANCE; + static { + PredictionSet defaultInstance = new PredictionSet(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + PredictionSet.class, defaultInstance); + } + + public static tech.donau.behaiv.proto.PredictionSet getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } +} + diff --git a/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java new file mode 100644 index 0000000..2784ed4 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/PredictionSetOrBuilder.java @@ -0,0 +1,29 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public interface PredictionSetOrBuilder extends + // @@protoc_insertion_point(interface_extends:PredictionSet) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * repeated .Prediction prediction = 1; + */ + java.util.List + getPredictionList(); + /** + * repeated .Prediction prediction = 1; + */ + tech.donau.behaiv.proto.Prediction getPrediction(int index); + /** + * repeated .Prediction prediction = 1; + */ + int getPredictionCount(); + + /** + * bool dynamicColumns = 2; + * @return The dynamicColumns. + */ + boolean getDynamicColumns(); +} diff --git a/src/main/java/tech/donau/behaiv/proto/Screen.java b/src/main/java/tech/donau/behaiv/proto/Screen.java new file mode 100644 index 0000000..ff55de4 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/Screen.java @@ -0,0 +1,342 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +/** + * Protobuf type {@code Screen} + */ +public final class Screen extends + com.google.protobuf.GeneratedMessageLite< + Screen, Screen.Builder> implements + // @@protoc_insertion_point(message_implements:Screen) + ScreenOrBuilder { + private Screen() { + name_ = ""; + } + public static final int ID_FIELD_NUMBER = 1; + private int id_; + /** + * int32 id = 1; + * @return The id. + */ + @java.lang.Override + public int getId() { + return id_; + } + /** + * int32 id = 1; + * @param value The id to set. + */ + private void setId(int value) { + + id_ = value; + } + /** + * int32 id = 1; + */ + private void clearId() { + + id_ = 0; + } + + public static final int NAME_FIELD_NUMBER = 2; + private java.lang.String name_; + /** + * string name = 2; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + return name_; + } + /** + * string name = 2; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(name_); + } + /** + * string name = 2; + * @param value The name to set. + */ + private void setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + } + /** + * string name = 2; + */ + private void clearName() { + + name_ = getDefaultInstance().getName(); + } + /** + * string name = 2; + * @param value The bytes for name to set. + */ + private void setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value.toStringUtf8(); + } + + public static tech.donau.behaiv.proto.Screen parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Screen parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static tech.donau.behaiv.proto.Screen parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static tech.donau.behaiv.proto.Screen parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Screen parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static tech.donau.behaiv.proto.Screen parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(tech.donau.behaiv.proto.Screen prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code Screen} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + tech.donau.behaiv.proto.Screen, Builder> implements + // @@protoc_insertion_point(builder_implements:Screen) + tech.donau.behaiv.proto.ScreenOrBuilder { + // Construct using tech.donau.behaiv.proto.Screen.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * int32 id = 1; + * @return The id. + */ + @java.lang.Override + public int getId() { + return instance.getId(); + } + /** + * int32 id = 1; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId(int value) { + copyOnWrite(); + instance.setId(value); + return this; + } + /** + * int32 id = 1; + * @return This builder for chaining. + */ + public Builder clearId() { + copyOnWrite(); + instance.clearId(); + return this; + } + + /** + * string name = 2; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + return instance.getName(); + } + /** + * string name = 2; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + return instance.getNameBytes(); + } + /** + * string name = 2; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + copyOnWrite(); + instance.setName(value); + return this; + } + /** + * string name = 2; + * @return This builder for chaining. + */ + public Builder clearName() { + copyOnWrite(); + instance.clearName(); + return this; + } + /** + * string name = 2; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setNameBytes(value); + return this; + } + + // @@protoc_insertion_point(builder_scope:Screen) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new tech.donau.behaiv.proto.Screen(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "id_", + "name_", + }; + java.lang.String info = + "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u0004\u0002\u0208" + + ""; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (tech.donau.behaiv.proto.Screen.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:Screen) + private static final tech.donau.behaiv.proto.Screen DEFAULT_INSTANCE; + static { + Screen defaultInstance = new Screen(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + Screen.class, defaultInstance); + } + + public static tech.donau.behaiv.proto.Screen getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } +} + diff --git a/src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java b/src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java new file mode 100644 index 0000000..ae20b83 --- /dev/null +++ b/src/main/java/tech/donau/behaiv/proto/ScreenOrBuilder.java @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: behaiv.proto + +package tech.donau.behaiv.proto; + +public interface ScreenOrBuilder extends + // @@protoc_insertion_point(interface_extends:Screen) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * int32 id = 1; + * @return The id. + */ + int getId(); + + /** + * string name = 2; + * @return The name. + */ + java.lang.String getName(); + /** + * string name = 2; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} From 76af0afe2ecb8111cdd5c29cd830329567638868 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 10:46:32 +0100 Subject: [PATCH 16/23] Added method to convert List,String> to PredictionSet --- .../dmi3y/behaiv/tools/DataMappingUtils.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java index a66f278..718b98a 100644 --- a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java +++ b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java @@ -1,6 +1,9 @@ package de.dmi3y.behaiv.tools; import org.apache.commons.lang3.ArrayUtils; +import tech.donau.behaiv.proto.Data; +import tech.donau.behaiv.proto.Prediction; +import tech.donau.behaiv.proto.PredictionSet; import java.util.ArrayList; import java.util.HashSet; @@ -14,6 +17,23 @@ private DataMappingUtils() { // Unused utility class } + public static PredictionSet createPredictionSet(List, String>> data) { + final PredictionSet.Builder predictionSetBuilder = PredictionSet.newBuilder(); + for (int i = 0; i < data.size(); i++) { + final List weights = data.get(i).getKey(); + final ArrayList row = new ArrayList<>(); + for (int j = 0; j < weights.size(); j++) { + row.add(Data.newBuilder().setKey("key"+j).setValue(weights.get(j)).build()); + } + predictionSetBuilder.addPrediction( + Prediction.newBuilder() + .addAllData(row) + .setPrediction(data.get(i).getValue()) + .build() + ); + } + return predictionSetBuilder.build(); + } public static List toDistinctListOfPairValues(List, String>> data) { Set setOfValues = new HashSet<>(); From 6f0f766d99a74008931c85fe4d5e436d9e24cb48 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 12:30:56 +0100 Subject: [PATCH 17/23] Test for DataMappingUtilsTest::createPredictionSet --- .../dmi3y/behaiv/tools/DataMappingUtilsTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java b/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java index 09e218e..f9f5f50 100644 --- a/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java +++ b/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java @@ -2,6 +2,8 @@ import org.junit.Test; import org.mockito.internal.matchers.Null; +import tech.donau.behaiv.proto.Prediction; +import tech.donau.behaiv.proto.PredictionSet; import java.util.ArrayList; import java.util.Arrays; @@ -13,6 +15,19 @@ public class DataMappingUtilsTest { + + @Test + public void createPredictionSet_feedDefaultTestData_expectCorrectOrder() { + final Pair, String> mockData = getMockPairListDoubleStringData(); + final PredictionSet predictionSet = DataMappingUtils.createPredictionSet(Collections.singletonList(mockData)); + assertEquals(1, predictionSet.getPredictionCount()); + final Prediction prediction = predictionSet.getPrediction(0); + assertEquals("Potato", prediction.getPrediction()); + assertEquals(1, prediction.getDataCount()); + assertEquals("key0", prediction.getData(0).getKey()); + assertEquals(20d, prediction.getData(0).getValue(), 0); + } + @Test public void toDistinctListOfPairValues_withInputData_returnsExpectedDistinctListOfPairValues() { List, String>> mockData = Arrays.asList( From 7d8f9408ed356e1c0b0e3ee99148401c3d0d08a4 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 19:53:29 +0100 Subject: [PATCH 18/23] Ignore tech.donau.behaiv.proto package on jacoco reports --- build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index 6145c76..186a595 100644 --- a/build.gradle +++ b/build.gradle @@ -80,6 +80,11 @@ jacocoTestReport { xml.enabled = true csv.enabled = false } + afterEvaluate { + classDirectories.setFrom(files(classDirectories.files.collect { + fileTree(dir: it, exclude: 'tech/donau/behaiv/proto**') + })) + } } task proto(type: Exec) { From 8fd8cb94f6c18a6239381fbab8b5ab0dc58e812b Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 7 Mar 2020 20:03:36 +0100 Subject: [PATCH 19/23] added test for LogisticRegressionKernel to check if partial fit is allowed --- .../dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java b/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java index 1a6fdf4..6cbbacd 100644 --- a/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java +++ b/src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java @@ -57,6 +57,12 @@ public void predictOne() { assertEquals("SELFIMPROVEMENT_SCREEN", prediction); } + @Test + public void isPartialFitAllowed_inLogisticRegression_shouldReturnFalse() { + final Kernel kernel = new LogisticRegressionKernel("testId"); + assertFalse(kernel.isPartialFitAllowed()); + } + @Test public void storeResults() throws IOException, ClassNotFoundException { List, String>> data = KernelTest.getTrainingData(); From 5598514f82e1c9174a76915fe71fd5d3d31a0d01 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 4 Apr 2020 12:33:00 +0300 Subject: [PATCH 20/23] fixed DataMappingUtils to match proto files --- src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java index 718b98a..7b1a249 100644 --- a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java +++ b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java @@ -28,7 +28,7 @@ public static PredictionSet createPredictionSet(List, String>> predictionSetBuilder.addPrediction( Prediction.newBuilder() .addAllData(row) - .setPrediction(data.get(i).getValue()) + .setLabel(data.get(i).getValue()) .build() ); } From 704b53eb5f547e7455a0457523a58190fbb728e8 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 4 Apr 2020 12:33:14 +0300 Subject: [PATCH 21/23] fixed DataMappingUtilsTest to match proto files --- src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java b/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java index f9f5f50..db3675c 100644 --- a/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java +++ b/src/test/java/de/dmi3y/behaiv/tools/DataMappingUtilsTest.java @@ -22,7 +22,7 @@ public void createPredictionSet_feedDefaultTestData_expectCorrectOrder() { final PredictionSet predictionSet = DataMappingUtils.createPredictionSet(Collections.singletonList(mockData)); assertEquals(1, predictionSet.getPredictionCount()); final Prediction prediction = predictionSet.getPrediction(0); - assertEquals("Potato", prediction.getPrediction()); + assertEquals("Potato", prediction.getLabel()); assertEquals(1, prediction.getDataCount()); assertEquals("key0", prediction.getData(0).getKey()); assertEquals(20d, prediction.getData(0).getValue(), 0); From 2e94aacfc22d19df7bbb1aa50d9a4e8c4676a7b5 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 4 Apr 2020 12:44:55 +0300 Subject: [PATCH 22/23] Converting to and from predictionSet, fixed BaseKernel --- .../de/dmi3y/behaiv/kernel/BaseKernel.java | 27 ++++++++++--------- .../dmi3y/behaiv/tools/DataMappingUtils.java | 15 +++++++++++ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java b/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java index 04ef86b..99ba00e 100644 --- a/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java +++ b/src/main/java/de/dmi3y/behaiv/kernel/BaseKernel.java @@ -2,11 +2,18 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.protobuf.CodedOutputStream; import de.dmi3y.behaiv.storage.BehaivStorage; +import de.dmi3y.behaiv.tools.DataMappingUtils; import de.dmi3y.behaiv.tools.Pair; +import tech.donau.behaiv.proto.PredictionSet; import java.io.BufferedReader; import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; @@ -78,23 +85,19 @@ public void setAlwaysKeepData(boolean alwaysKeepData) { @Override public void save(BehaivStorage storage) throws IOException { - - try (final BufferedWriter writer = new BufferedWriter(new FileWriter(storage.getDataFile(id)))) { - writer.write(objectMapper.writeValueAsString(data)); + final File dataFile = storage.getDataFile(id); + final PredictionSet predictionSet = DataMappingUtils.createPredictionSet(data); + try(FileOutputStream fileOutputStream = new FileOutputStream(dataFile)) { + predictionSet.writeTo(fileOutputStream); } } @Override public void restore(BehaivStorage storage) throws IOException { - final TypeReference, String>>> typeReference = new TypeReference, String>>>() { - }; - try (final BufferedReader reader = new BufferedReader(new FileReader(storage.getDataFile(id)))) { - final String content = reader.readLine(); - if (content == null || content.isEmpty()) { - data = new ArrayList<>(); - } else { - data = objectMapper.readValue(content, typeReference); - } + final File dataFile = storage.getDataFile(id); + try (FileInputStream fileInputStream = new FileInputStream(dataFile)) { + final PredictionSet predictionSet = PredictionSet.parseFrom(fileInputStream); + data = DataMappingUtils.dataFromPredictionSet(predictionSet); } } } diff --git a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java index 7b1a249..5deec47 100644 --- a/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java +++ b/src/main/java/de/dmi3y/behaiv/tools/DataMappingUtils.java @@ -35,6 +35,21 @@ public static PredictionSet createPredictionSet(List, String>> return predictionSetBuilder.build(); } + public static List, String>> dataFromPredictionSet(PredictionSet predictionSet) { + final ArrayList, String>> data = new ArrayList<>(); + for (int i = 0; i < predictionSet.getPredictionCount(); i++) { + final Prediction prediction = predictionSet.getPrediction(i); + final List dataList = prediction.getDataList(); + final String label = prediction.getLabel(); + final List entries = new ArrayList<>(); + for (Data entry : dataList) { + entries.add(entry.getValue()); + } + data.add(Pair.create(entries, label)); + } + return data; + } + public static List toDistinctListOfPairValues(List, String>> data) { Set setOfValues = new HashSet<>(); for(Pair, String> arrayListStringPair : data ) { From b7e8a159e76e5d5aa20ee7eb63cd42a5b01a4047 Mon Sep 17 00:00:00 2001 From: dmi3coder Date: Sat, 4 Apr 2020 13:59:52 +0300 Subject: [PATCH 23/23] Bumbed version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 41aff2b..589b13e 100644 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,7 @@ publishing { gpr(MavenPublication) { groupId = 'tech.donau.behaiv' artifactId = 'behaiv-java' - version = '0.4.8-alpha' + version = '0.4.10-alpha' from(components.java) } }