From 5940cb3f8a596d42d035794bbe6a667adc61601e Mon Sep 17 00:00:00 2001 From: Adam Pocock Date: Thu, 2 Jun 2022 13:16:30 -0400 Subject: [PATCH] Adds protobuf serialization to FeatureMap, Hasher, and VariableInfo implementations (#226) * Roughing out the core tribuo protos. * Adding protobuf serialization for FeatureMap, subclasses and fields of FeatureMap. * Adding generated protos. * Adding equals methods to CategoricalInfo and RealInfo, and added an equality test to CategoricalInfoTest. * Adding equals methods to Hashers, and adding HashedFeatureMap.serialize(). * Adding equals methods to FeatureMap and MutableFeatureMap, and tests for equality and serialization in FeatureMapTest. * Removing generated protos for ease of reviewing. * Fix the javadoc in ProtoSerializable. * Adding support for serializing TransformerMap. * Adding protobuf serialization to org.tribuo.transform.transformations. * Fixing copyrights. * Adding tests for transformation serialization. Made the transformer implementations package private so they are easier to test. * initial scratchings of ProtobufClass/Field annotations and ProtoUtil.serialize method * moved ProtoUtilTest to org.tribuo to allow testing of protected method * added protobuf generated source files * added @ProtobufField and @ProtobufClass to a bunch of class defs - major update to ProtoUtil.serialize to handle more cases - added a bunch of tests to ProtoUtilTest - replaced serialize method impls with ProtoUtil.serialize - CategoricalIDInfo/CategoricalInfo - handles observedValue and observedCount separately from valueCounts - CategoricalInfo has an id member set to -1 - added version attribute to ProtobufClass annotation * renamed annotations ProtoSerializable has default serialize method ProtoSerializableClass no longer has 'serializedClass' attribute and is no longer repeatable added RealIDInfoProto and CategricalIDInfoProto removed CategoricalInfo.id and RealInfo.id removed various serialize methods in favor of default method new annotation ProtoSerializableKeysValuesField towards cleaning up ProtoUtil.serialize ReflectUtil gives the type parameter assignments for an object's interface type parameters * default deserialize method replaces "instantiate" added @ProtoSerializableMapValuesField remove register redirects clean up serialization of fields logic - remove getMapFields - clean up getFields findMethod can be used for setters and getters by specifying expected param count. * moved protoserializable code into protos package remove various compile warnings in package. * initial commit of ProtoSerializableArrayField which allows you to annotate e.g. an array of doubles as done in BinningTransformer (found in BinningTransformation). * removed unneeded serialize methods * updated tests to be consistent * added @ProtoSerializable annotations to two transformers * removes initial attempt at generic but underspecified deserialize method developer must implement deserializeFromProto and won't get a crappy solution that does something if they don't. also, put back in detailed error handling messages in the higher-level 'deserialize' method (FKA 'instantiate'). * reimplemented ReflectUtil to pull out one type parameter resolution this version has a bunch of sysout statements added unit tests * cleaned up reimplementation of ReflectUtil functionality. better unit tests removed sysout statements fixed a bug found in unit tests. * SimpleTransform replace serialize() impl fix problem with field name in annotation * moved functionality in ReflectUtil to ProtoUtil and made it private * added @ProtoSerializableClass annotation to LinearScalingTransformer refactored serialize() * added @ProtoSerializableClass to IDFTransformer and refactored serialize added unit test * removed default impl for ProtoSerializable.serialize added default impls to all the effected subclasses that now require them. * Formatting and licenses. * Removing ProtoSerializableArrayField, cleaning up the use of maps, making version not default, adding javadoc. * Tidying up ProtoUtil. * Adding internal redirect hook. * Narrowing the visibility of some methods in ProtoUtil. * Adding static version field. Improving validation of deserialized objects. * Adding docs about hasher deserialization. * Adding more logging and exceptions to ProtoUtil. * Fix ModHashCodeHasher deserialize. Co-authored-by: Philip Ogren --- .../java/org/tribuo/CategoricalIDInfo.java | 97 + .../main/java/org/tribuo/CategoricalInfo.java | 99 + Core/src/main/java/org/tribuo/FeatureMap.java | 35 +- .../java/org/tribuo/ImmutableFeatureMap.java | 45 +- .../java/org/tribuo/MutableFeatureMap.java | 67 +- Core/src/main/java/org/tribuo/RealIDInfo.java | 65 +- Core/src/main/java/org/tribuo/RealInfo.java | 76 +- .../java/org/tribuo/SkeletalVariableInfo.java | 4 + .../main/java/org/tribuo/VariableInfo.java | 7 +- .../java/org/tribuo/hash/HashCodeHasher.java | 51 + .../org/tribuo/hash/HashedFeatureMap.java | 47 +- .../src/main/java/org/tribuo/hash/Hasher.java | 12 +- .../org/tribuo/hash/MessageDigestHasher.java | 64 + .../org/tribuo/hash/ModHashCodeHasher.java | 59 + .../java/org/tribuo/hash/package-info.java | 4 + .../org/tribuo/protos/ProtoSerializable.java | 53 + .../tribuo/protos/ProtoSerializableClass.java | 45 + .../tribuo/protos/ProtoSerializableField.java | 50 + .../ProtoSerializableKeysValuesField.java | 49 + .../ProtoSerializableMapValuesField.java | 43 + .../java/org/tribuo/protos/ProtoUtil.java | 480 +++++ .../protos/core/BinningTransformerProto.java | 917 +++++++++ .../BinningTransformerProtoOrBuilder.java | 55 + .../protos/core/CategoricalIDInfoProto.java | 1179 +++++++++++ .../core/CategoricalIDInfoProtoOrBuilder.java | 79 + .../protos/core/CategoricalInfoProto.java | 1115 +++++++++++ .../core/CategoricalInfoProtoOrBuilder.java | 73 + .../org/tribuo/protos/core/DatasetProto.java | 1734 +++++++++++++++++ .../protos/core/DatasetProtoOrBuilder.java | 111 ++ .../protos/core/EnsembleCombinerProto.java | 819 ++++++++ .../core/EnsembleCombinerProtoOrBuilder.java | 42 + .../org/tribuo/protos/core/ExampleProto.java | 1474 ++++++++++++++ .../protos/core/ExampleProtoOrBuilder.java | 120 ++ .../protos/core/FeatureDomainProto.java | 819 ++++++++ .../core/FeatureDomainProtoOrBuilder.java | 42 + .../protos/core/HashedFeatureMapProto.java | 968 +++++++++ .../core/HashedFeatureMapProtoOrBuilder.java | 48 + .../org/tribuo/protos/core/HasherProto.java | 819 ++++++++ .../protos/core/HasherProtoOrBuilder.java | 42 + .../protos/core/IDFTransformerProto.java | 561 ++++++ .../core/IDFTransformerProtoOrBuilder.java | 21 + .../protos/core/ImmutableFeatureMapProto.java | 780 ++++++++ .../ImmutableFeatureMapProtoOrBuilder.java | 33 + .../core/LinearScalingTransformerProto.java | 693 +++++++ ...inearScalingTransformerProtoOrBuilder.java | 33 + .../core/MeanStdDevTransformerProto.java | 693 +++++++ .../MeanStdDevTransformerProtoOrBuilder.java | 33 + .../tribuo/protos/core/MeanVarianceProto.java | 822 ++++++++ .../core/MeanVarianceProtoOrBuilder.java | 45 + .../protos/core/MessageDigestHasherProto.java | 567 ++++++ .../MessageDigestHasherProtoOrBuilder.java | 21 + .../protos/core/ModHashCodeHasherProto.java | 493 +++++ .../core/ModHashCodeHasherProtoOrBuilder.java | 15 + .../tribuo/protos/core/ModelDataProto.java | 819 ++++++++ .../protos/core/ModelDataProtoOrBuilder.java | 42 + .../org/tribuo/protos/core/ModelProto.java | 1700 ++++++++++++++++ .../protos/core/ModelProtoOrBuilder.java | 157 ++ .../protos/core/MutableFeatureMapProto.java | 845 ++++++++ .../core/MutableFeatureMapProtoOrBuilder.java | 39 + .../tribuo/protos/core/OutputDomainProto.java | 819 ++++++++ .../core/OutputDomainProtoOrBuilder.java | 42 + .../protos/core/OutputFactoryProto.java | 819 ++++++++ .../core/OutputFactoryProtoOrBuilder.java | 42 + .../org/tribuo/protos/core/OutputProto.java | 819 ++++++++ .../protos/core/OutputProtoOrBuilder.java | 42 + .../tribuo/protos/core/PredictionProto.java | 1489 ++++++++++++++ .../protos/core/PredictionProtoOrBuilder.java | 111 ++ .../tribuo/protos/core/RealIDInfoProto.java | 959 +++++++++ .../protos/core/RealIDInfoProtoOrBuilder.java | 57 + .../org/tribuo/protos/core/RealInfoProto.java | 895 +++++++++ .../protos/core/RealInfoProtoOrBuilder.java | 51 + .../protos/core/SimpleTransformProto.java | 699 +++++++ .../core/SimpleTransformProtoOrBuilder.java | 33 + .../core/TestCountTransformerProto.java | 910 +++++++++ .../TestCountTransformerProtoOrBuilder.java | 55 + .../protos/core/TransformerListProto.java | 780 ++++++++ .../core/TransformerListProtoOrBuilder.java | 33 + .../protos/core/TransformerMapProto.java | 1158 +++++++++++ .../core/TransformerMapProtoOrBuilder.java | 81 + .../tribuo/protos/core/TransformerProto.java | 819 ++++++++ .../core/TransformerProtoOrBuilder.java | 42 + .../org/tribuo/protos/core/TribuoCore.java | 317 +++ .../tribuo/protos/core/TribuoCoreImpl.java | 242 +++ .../tribuo/protos/core/VariableInfoProto.java | 819 ++++++++ .../core/VariableInfoProtoOrBuilder.java | 42 + .../java/org/tribuo/protos/package-info.java | 40 + .../org/tribuo/transform/Transformer.java | 16 +- .../org/tribuo/transform/TransformerMap.java | 85 +- .../BinningTransformation.java | 73 +- .../transformations/IDFTransformation.java | 63 +- .../LinearScalingTransformation.java | 61 +- .../MeanStdDevTransformation.java | 61 +- .../transformations/SimpleTransform.java | 54 +- .../resources/protos/tribuo-core-impl.proto | 174 ++ .../main/resources/protos/tribuo-core.proto | 215 ++ .../java/org/tribuo/CategoricalInfoTest.java | 145 +- .../test/java/org/tribuo/FeatureMapTest.java | 116 ++ .../java/org/tribuo/protos/ProtoUtilTest.java | 216 ++ .../transform/TransformationMapTest.java | 230 ++- .../{ => transformations}/BinningTest.java | 32 +- .../transformations/IDFTransformTest.java | 44 + .../LinearScalingTest.java | 42 +- .../{ => transformations}/MeanStdDevTest.java | 40 +- .../SimpleTransformTest.java | 42 +- 104 files changed, 34124 insertions(+), 120 deletions(-) create mode 100644 Core/src/main/java/org/tribuo/protos/ProtoSerializable.java create mode 100644 Core/src/main/java/org/tribuo/protos/ProtoSerializableClass.java create mode 100644 Core/src/main/java/org/tribuo/protos/ProtoSerializableField.java create mode 100644 Core/src/main/java/org/tribuo/protos/ProtoSerializableKeysValuesField.java create mode 100644 Core/src/main/java/org/tribuo/protos/ProtoSerializableMapValuesField.java create mode 100644 Core/src/main/java/org/tribuo/protos/ProtoUtil.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/BinningTransformerProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/BinningTransformerProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/CategoricalIDInfoProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/CategoricalIDInfoProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/CategoricalInfoProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/CategoricalInfoProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/DatasetProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/DatasetProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/EnsembleCombinerProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/EnsembleCombinerProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/ExampleProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/ExampleProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/FeatureDomainProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/FeatureDomainProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/HashedFeatureMapProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/HashedFeatureMapProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/HasherProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/HasherProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/IDFTransformerProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/IDFTransformerProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/ImmutableFeatureMapProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/ImmutableFeatureMapProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/LinearScalingTransformerProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/LinearScalingTransformerProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/MeanStdDevTransformerProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/MeanStdDevTransformerProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/MeanVarianceProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/MeanVarianceProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/MessageDigestHasherProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/MessageDigestHasherProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/ModHashCodeHasherProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/ModHashCodeHasherProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/ModelDataProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/ModelDataProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/ModelProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/ModelProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/MutableFeatureMapProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/MutableFeatureMapProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/OutputDomainProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/OutputDomainProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/OutputFactoryProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/OutputFactoryProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/OutputProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/OutputProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/PredictionProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/PredictionProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/RealIDInfoProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/RealIDInfoProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/RealInfoProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/RealInfoProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/SimpleTransformProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/SimpleTransformProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/TestCountTransformerProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/TestCountTransformerProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/TransformerListProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/TransformerListProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/TransformerMapProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/TransformerMapProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/TransformerProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/TransformerProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/TribuoCore.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/TribuoCoreImpl.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/VariableInfoProto.java create mode 100644 Core/src/main/java/org/tribuo/protos/core/VariableInfoProtoOrBuilder.java create mode 100644 Core/src/main/java/org/tribuo/protos/package-info.java create mode 100644 Core/src/main/resources/protos/tribuo-core-impl.proto create mode 100644 Core/src/main/resources/protos/tribuo-core.proto create mode 100644 Core/src/test/java/org/tribuo/FeatureMapTest.java create mode 100644 Core/src/test/java/org/tribuo/protos/ProtoUtilTest.java rename Core/src/test/java/org/tribuo/transform/{ => transformations}/BinningTest.java (88%) create mode 100644 Core/src/test/java/org/tribuo/transform/transformations/IDFTransformTest.java rename Core/src/test/java/org/tribuo/transform/{ => transformations}/LinearScalingTest.java (77%) rename Core/src/test/java/org/tribuo/transform/{ => transformations}/MeanStdDevTest.java (73%) rename Core/src/test/java/org/tribuo/transform/{ => transformations}/SimpleTransformTest.java (89%) diff --git a/Core/src/main/java/org/tribuo/CategoricalIDInfo.java b/Core/src/main/java/org/tribuo/CategoricalIDInfo.java index c8262160b..a13f97f7f 100644 --- a/Core/src/main/java/org/tribuo/CategoricalIDInfo.java +++ b/Core/src/main/java/org/tribuo/CategoricalIDInfo.java @@ -16,12 +16,30 @@ package org.tribuo; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; +import com.oracle.labs.mlrg.olcut.util.MutableLong; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.core.CategoricalIDInfoProto; + +import java.util.HashMap; +import java.util.List; +import java.util.Objects; + /** * Same as a {@link CategoricalInfo}, but with an additional int id field. */ +@ProtoSerializableClass(version = CategoricalIDInfo.CURRENT_VERSION, serializedDataClass = CategoricalIDInfoProto.class) public class CategoricalIDInfo extends CategoricalInfo implements VariableIDInfo { private static final long serialVersionUID = 2L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + + @ProtoSerializableField private final int id; /** @@ -31,6 +49,9 @@ public class CategoricalIDInfo extends CategoricalInfo implements VariableIDInfo */ public CategoricalIDInfo(CategoricalInfo info, int id) { super(info); + if (id < 0) { + throw new IllegalArgumentException("Invalid id number, must be non-negative, found " + id); + } this.id = id; } @@ -46,6 +67,61 @@ private CategoricalIDInfo(CategoricalIDInfo info, String newName) { this.id = info.id; } + /** + * Deserialization constructor. + * @param name The info name. + * @param id The info id. + */ + private CategoricalIDInfo(String name, int id) { + super(name); + if (id < 0) { + throw new IllegalArgumentException("Invalid id number, must be non-negative, found " + id); + } + this.id = id; + } + + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + */ + public static CategoricalIDInfo deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + if (version < 0 || version > CURRENT_VERSION) { + throw new IllegalArgumentException("Unknown version " + version + ", this class supports at most version " + CURRENT_VERSION); + } + CategoricalIDInfoProto proto = message.unpack(CategoricalIDInfoProto.class); + CategoricalIDInfo info = new CategoricalIDInfo(proto.getName(),proto.getId()); + List keys = proto.getKeyList(); + List values = proto.getValueList(); + if (keys.size() != values.size()) { + throw new IllegalStateException("Invalid protobuf, keys and values don't match. keys.size() = " + keys.size() + ", values.size() = " + values.size()); + } + int newCount = 0; + if (keys.size() > 1) { + info.valueCounts = new HashMap<>(keys.size()); + for (int i = 0; i < keys.size(); i++) { + if (values.get(i) < 0) { + throw new IllegalStateException("Invalid protobuf, counts must be positive, found " + values.get(i) + " for value " + keys.get(i)); + } + info.valueCounts.put(keys.get(i),new MutableLong(values.get(i))); + newCount += values.get(i).intValue(); + } + } else { + info.observedValue = proto.getObservedValue(); + info.observedCount = proto.getObservedCount(); + newCount = (int) proto.getObservedCount(); + if (info.observedCount < 0) { + throw new IllegalStateException("Invalid protobuf, counts must be positive, found " + info.observedCount + " for value " + info.observedValue); + } + } + if (newCount != proto.getCount()) { + throw new IllegalStateException("Invalid protobuf, count " + newCount + " did not match expected value " + proto.getCount()); + } + info.count = newCount; + return info; + } + @Override public int getID() { return id; @@ -84,4 +160,25 @@ public String toString() { return "CategoricalFeature(name=" + name + ",id=" + id + ",count=" + count + ",map={" +observedValue+","+observedCount+"})"; } } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + CategoricalIDInfo that = (CategoricalIDInfo) o; + return id == that.id; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), id); + } + } diff --git a/Core/src/main/java/org/tribuo/CategoricalInfo.java b/Core/src/main/java/org/tribuo/CategoricalInfo.java index 0f7f09be0..e22e5d4d9 100644 --- a/Core/src/main/java/org/tribuo/CategoricalInfo.java +++ b/Core/src/main/java/org/tribuo/CategoricalInfo.java @@ -16,8 +16,16 @@ package org.tribuo; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; import com.oracle.labs.mlrg.olcut.util.MutableLong; import com.oracle.labs.mlrg.olcut.util.MutableNumber; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.ProtoSerializableKeysValuesField; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.CategoricalInfoProto; +import org.tribuo.protos.core.VariableInfoProto; import org.tribuo.util.Util; import java.io.IOException; @@ -25,6 +33,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Random; import java.util.SplittableRandom; import java.util.stream.Collectors; @@ -47,9 +56,15 @@ * are recomputed. Care should be taken if data is read while {@link #observe(double)} is called. *

*/ +@ProtoSerializableClass(version = CategoricalInfo.CURRENT_VERSION, serializedDataClass = CategoricalInfoProto.class) public class CategoricalInfo extends SkeletalVariableInfo { private static final long serialVersionUID = 2L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + private static final MutableLong ZERO = new MutableLong(0); /** * The default threshold for converting a categorical info into a {@link RealInfo}. @@ -60,16 +75,19 @@ public class CategoricalInfo extends SkeletalVariableInfo { /** * The occurrence counts of each value. */ + @ProtoSerializableKeysValuesField(keysName="key", valuesName="value") protected Map valueCounts = null; /** * The observed value if it's only seen a single one. */ + @ProtoSerializableField protected double observedValue = Double.NaN; /** * The count of the observed value if it's only seen a single one. */ + @ProtoSerializableField protected long observedCount = 0; // These variables are used in the sampling methods, and regenerated after serialization if a sample is required. @@ -117,6 +135,50 @@ protected CategoricalInfo(CategoricalInfo info, String newName) { } } + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + */ + public static CategoricalInfo deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + if (version < 0 || version > CURRENT_VERSION) { + throw new IllegalArgumentException("Unknown version " + version + ", this class supports at most version " + CURRENT_VERSION); + } + CategoricalInfoProto proto = message.unpack(CategoricalInfoProto.class); + CategoricalInfo info = new CategoricalInfo(proto.getName()); + List keys = proto.getKeyList(); + List values = proto.getValueList(); + if (keys.size() != values.size()) { + throw new IllegalStateException("Invalid protobuf, keys and values don't match. keys.size() = " + keys.size() + ", values.size() = " + values.size()); + } + int newCount = 0; + if (keys.size() > 1) { + info.valueCounts = new HashMap<>(keys.size()); + for (int i = 0; i < keys.size(); i++) { + if (values.get(i) < 0) { + throw new IllegalStateException("Invalid protobuf, counts must be positive, found " + values.get(i) + " for value " + keys.get(i)); + } + info.valueCounts.put(keys.get(i),new MutableLong(values.get(i))); + newCount += values.get(i).intValue(); + } + } else { + info.observedValue = proto.getObservedValue(); + info.observedCount = proto.getObservedCount(); + newCount = (int) proto.getObservedCount(); + if (info.observedCount < 0) { + throw new IllegalStateException("Invalid protobuf, counts must be positive, found " + info.observedCount + " for value " + info.observedValue); + } + } + info.count = newCount; + return info; + } + + @Override + public VariableInfoProto serialize() { + return ProtoUtil.serialize(this); + } + @Override protected void observe(double value) { if (value != 0.0) { @@ -361,6 +423,43 @@ private synchronized void regenerateValues() { } } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + CategoricalInfo that = (CategoricalInfo) o; + // MutableLong in OLCUT 5.2.0 doesn't implement equals, + // so we can't compare valueCounts with Objects.equals. + // That'll be fixed in the next OLCUT but for the time being we've got this workaround. + if (valueCounts != null ^ that.valueCounts != null) { + return false; + } else if (valueCounts != null && that.valueCounts != null) { + if (valueCounts.size() != that.valueCounts.size()) { + return false; + } else { + for (Map.Entry e : valueCounts.entrySet()) { + MutableLong other = that.valueCounts.get(e.getKey()); + if ((other == null) || (e.getValue().longValue() != other.longValue())) { + return false; + } + } + } + } + return Double.compare(that.observedValue, observedValue) == 0 && observedCount == that.observedCount; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), valueCounts, observedValue, observedCount); + } + @Override public String toString() { if (valueCounts != null) { diff --git a/Core/src/main/java/org/tribuo/FeatureMap.java b/Core/src/main/java/org/tribuo/FeatureMap.java index 7bff4fc6b..b659c298e 100644 --- a/Core/src/main/java/org/tribuo/FeatureMap.java +++ b/Core/src/main/java/org/tribuo/FeatureMap.java @@ -16,10 +16,16 @@ package org.tribuo; +import org.tribuo.protos.core.FeatureDomainProto; +import org.tribuo.protos.ProtoSerializable; +import org.tribuo.protos.ProtoSerializableMapValuesField; +import org.tribuo.protos.ProtoUtil; + import java.io.Serializable; import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.TreeMap; @@ -27,12 +33,13 @@ * A map from Strings to {@link VariableInfo} objects storing * information about a feature. */ -public abstract class FeatureMap implements Serializable, Iterable { +public abstract class FeatureMap implements Serializable, ProtoSerializable, Iterable { private static final long serialVersionUID = 1L; /** * Map from the feature names to their info. */ + @ProtoSerializableMapValuesField(valuesName = "info") protected final Map m; /** @@ -101,6 +108,23 @@ public Iterator iterator() { return m.values().iterator(); } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureMap that = (FeatureMap) o; + return m.equals(that.m); + } + + @Override + public int hashCode() { + return Objects.hash(m); + } + /** * Same as the toString, but ordered by name, and with newlines. * @return A String representation of this FeatureMap. @@ -136,4 +160,13 @@ public boolean domainEquals(FeatureMap other) { } } + /** + * Deserializes a {@link FeatureDomainProto} into a {@link FeatureMap} subclass. + * @param proto The proto to deserialize. + * @return The deserialized FeatureMap. + */ + public static FeatureMap deserialize(FeatureDomainProto proto) { + return ProtoUtil.deserialize(proto); + } + } diff --git a/Core/src/main/java/org/tribuo/ImmutableFeatureMap.java b/Core/src/main/java/org/tribuo/ImmutableFeatureMap.java index cf18c1c02..e0c6ae8cc 100644 --- a/Core/src/main/java/org/tribuo/ImmutableFeatureMap.java +++ b/Core/src/main/java/org/tribuo/ImmutableFeatureMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,14 @@ package org.tribuo; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.FeatureDomainProto; +import org.tribuo.protos.core.ImmutableFeatureMapProto; +import org.tribuo.protos.core.VariableInfoProto; + import java.io.Serializable; import java.util.HashMap; import java.util.List; @@ -32,9 +40,15 @@ * those features are unobserved. This is an extremely important property of {@link Feature}s, * {@link Example}s and {@link ImmutableFeatureMap}. */ +@ProtoSerializableClass(version = ImmutableFeatureMap.CURRENT_VERSION, serializedDataClass = ImmutableFeatureMapProto.class) public class ImmutableFeatureMap extends FeatureMap implements Serializable { private static final long serialVersionUID = 1L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + /** * The map from id numbers to the feature infos. */ @@ -83,6 +97,35 @@ protected ImmutableFeatureMap() { idMap = new HashMap<>(); } + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + */ + public static ImmutableFeatureMap deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + if (version < 0 || version > CURRENT_VERSION) { + throw new IllegalArgumentException("Unknown version " + version + ", this class supports at most version " + CURRENT_VERSION); + } + ImmutableFeatureMapProto proto = message.unpack(ImmutableFeatureMapProto.class); + ImmutableFeatureMap obj = new ImmutableFeatureMap(); + for (VariableInfoProto infoProto : proto.getInfoList()) { + VariableIDInfo info = ProtoUtil.deserialize(infoProto); + Object o = obj.idMap.put(info.getID(), info); + Object otherO = obj.m.put(info.getName(),info); + if ((o != null) || (otherO != null)) { + throw new IllegalStateException("Invalid protobuf, found two mappings for " + info.getName()); + } + } + obj.size = proto.getInfoCount(); + return obj; + } + + @Override + public FeatureDomainProto serialize() { + return ProtoUtil.serialize(this); + } + /** * Gets the {@link VariableIDInfo} * for this id number. Returns null if it's unknown. diff --git a/Core/src/main/java/org/tribuo/MutableFeatureMap.java b/Core/src/main/java/org/tribuo/MutableFeatureMap.java index 4fbade16c..79caa69bb 100644 --- a/Core/src/main/java/org/tribuo/MutableFeatureMap.java +++ b/Core/src/main/java/org/tribuo/MutableFeatureMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,30 @@ package org.tribuo; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.FeatureDomainProto; +import org.tribuo.protos.core.MutableFeatureMapProto; +import org.tribuo.protos.core.VariableInfoProto; + +import java.util.Objects; + /** * A feature map that can record new feature value observations. */ +@ProtoSerializableClass(version = MutableFeatureMap.CURRENT_VERSION, serializedDataClass = MutableFeatureMapProto.class) public class MutableFeatureMap extends FeatureMap { private static final long serialVersionUID = 2L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + + @ProtoSerializableField private final boolean convertHighCardinality; /** @@ -44,6 +62,33 @@ public MutableFeatureMap(boolean convertHighCardinality) { this.convertHighCardinality = convertHighCardinality; } + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + */ + public static MutableFeatureMap deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + if (version < 0 || version > CURRENT_VERSION) { + throw new IllegalArgumentException("Unknown version " + version + ", this class supports at most version " + CURRENT_VERSION); + } + MutableFeatureMapProto proto = message.unpack(MutableFeatureMapProto.class); + MutableFeatureMap obj = new MutableFeatureMap(proto.getConvertHighCardinality()); + for (VariableInfoProto infoProto : proto.getInfoList()) { + VariableInfo info = ProtoUtil.deserialize(infoProto); + Object o = obj.put(info); + if (o != null) { + throw new IllegalStateException("Invalid protobuf, found two mappings for " + info.getName()); + } + } + return obj; + } + + @Override + public FeatureDomainProto serialize() { + return ProtoUtil.serialize(this); + } + /** * Adds a variable info into the feature map. *

@@ -82,4 +127,24 @@ public void clear() { m.clear(); } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + MutableFeatureMap that = (MutableFeatureMap) o; + return convertHighCardinality == that.convertHighCardinality; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), convertHighCardinality); + } + } diff --git a/Core/src/main/java/org/tribuo/RealIDInfo.java b/Core/src/main/java/org/tribuo/RealIDInfo.java index 441536ece..eb4a73c5a 100644 --- a/Core/src/main/java/org/tribuo/RealIDInfo.java +++ b/Core/src/main/java/org/tribuo/RealIDInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,27 @@ package org.tribuo; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.core.RealIDInfoProto; + +import java.util.Objects; + /** * Same as a {@link RealInfo}, but with an additional int id field. */ +@ProtoSerializableClass(version = RealIDInfo.CURRENT_VERSION, serializedDataClass = RealIDInfoProto.class) public class RealIDInfo extends RealInfo implements VariableIDInfo { private static final long serialVersionUID = 1L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + + @ProtoSerializableField private final int id; /** @@ -36,6 +51,9 @@ public class RealIDInfo extends RealInfo implements VariableIDInfo { */ public RealIDInfo(String name, int count, double max, double min, double mean, double sumSquares, int id) { super(name,count,max,min,mean,sumSquares); + if (id < 0) { + throw new IllegalArgumentException("Invalid id number, must be non-negative, found " + id); + } this.id = id; } @@ -46,6 +64,9 @@ public RealIDInfo(String name, int count, double max, double min, double mean, d */ public RealIDInfo(RealInfo info, int id) { super(info); + if (id < 0) { + throw new IllegalArgumentException("Invalid id number, must be non-negative, found " + id); + } this.id = id; } @@ -59,6 +80,27 @@ private RealIDInfo(RealIDInfo info, String newName) { this.id = info.id; } + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + */ + public static RealIDInfo deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + if (version < 0 || version > CURRENT_VERSION) { + throw new IllegalArgumentException("Unknown version " + version + ", this class supports at most version " + CURRENT_VERSION); + } + RealIDInfoProto proto = message.unpack(RealIDInfoProto.class); + if (proto.getId() < 0) { + throw new IllegalStateException("Invalid protobuf, found no id where one was expected."); + } + RealIDInfo info = new RealIDInfo(proto.getName(),proto.getCount(), + proto.getMax(),proto.getMin(), + proto.getMean(),proto.getSumSquares(), + proto.getId()); + return info; + } + @Override public int getID() { return id; @@ -83,4 +125,25 @@ public RealIDInfo copy() { public String toString() { return String.format("RealFeature(name=%s,id=%d,count=%d,max=%f,min=%f,mean=%f,variance=%f)",name,id,count,max,min,mean,(sumSquares /(count-1))); } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + RealIDInfo that = (RealIDInfo) o; + return id == that.id; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), id); + } + } diff --git a/Core/src/main/java/org/tribuo/RealInfo.java b/Core/src/main/java/org/tribuo/RealInfo.java index 098303dde..d2b932551 100644 --- a/Core/src/main/java/org/tribuo/RealInfo.java +++ b/Core/src/main/java/org/tribuo/RealInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,15 @@ package org.tribuo; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; +import org.tribuo.protos.core.RealInfoProto; +import org.tribuo.protos.core.VariableInfoProto; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.ProtoUtil; + +import java.util.Objects; import java.util.SplittableRandom; /** @@ -26,27 +35,37 @@ * Does not contain an id number, but can be transformed into {@link RealIDInfo} which * does contain an id number. */ +@ProtoSerializableClass(version = RealInfo.CURRENT_VERSION, serializedDataClass = RealInfoProto.class) public class RealInfo extends SkeletalVariableInfo { private static final long serialVersionUID = 1L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + /** * The maximum observed feature value. */ + @ProtoSerializableField protected double max = Double.NEGATIVE_INFINITY; /** * The minimum observed feature value. */ + @ProtoSerializableField protected double min = Double.POSITIVE_INFINITY; /** * The feature mean. */ + @ProtoSerializableField protected double mean = 0.0; /** * The sum of the squared feature values (used to compute the variance). */ + @ProtoSerializableField protected double sumSquares = 0.0; /** @@ -79,6 +98,18 @@ public RealInfo(String name, int count) { */ public RealInfo(String name, int count, double max, double min, double mean, double sumSquares) { super(name, count); + if (max < min) { + throw new IllegalArgumentException("Invalid RealInfo, min greater than max."); + } + if (mean > max) { + throw new IllegalArgumentException("Invalid RealInfo, mean greater than max."); + } + if (mean < min) { + throw new IllegalArgumentException("Invalid RealInfo, mean less than min."); + } + if (sumSquares < 0) { + throw new IllegalArgumentException("Invalid RealInfo, variance must be non-negative."); + } this.max = max; this.min = min; this.mean = mean; @@ -106,6 +137,28 @@ protected RealInfo(RealInfo other, String newName) { this.sumSquares = other.sumSquares; } + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + */ + public static RealInfo deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + if (version < 0 || version > CURRENT_VERSION) { + throw new IllegalArgumentException("Unknown version " + version + ", this class supports at most version " + CURRENT_VERSION); + } + RealInfoProto proto = message.unpack(RealInfoProto.class); + RealInfo info = new RealInfo(proto.getName(),proto.getCount(), + proto.getMax(),proto.getMin(), + proto.getMean(),proto.getSumSquares()); + return info; + } + + @Override + public VariableInfoProto serialize() { + return ProtoUtil.serialize(this); + } + @Override protected void observe(double value) { if (value != 0.0) { @@ -175,8 +228,29 @@ public double uniformSample(SplittableRandom rng) { return (rng.nextDouble()*max) - min; } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + RealInfo realInfo = (RealInfo) o; + return Double.compare(realInfo.max, max) == 0 && Double.compare(realInfo.min, min) == 0 && Double.compare(realInfo.mean, mean) == 0 && Double.compare(realInfo.sumSquares, sumSquares) == 0; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), max, min, mean, sumSquares); + } + @Override public String toString() { return String.format("RealFeature(name=%s,count=%d,max=%f,min=%f,mean=%f,variance=%f)",name,count,max,min,mean,(sumSquares /(count-1))); } + } diff --git a/Core/src/main/java/org/tribuo/SkeletalVariableInfo.java b/Core/src/main/java/org/tribuo/SkeletalVariableInfo.java index deb782d01..8204c5b22 100644 --- a/Core/src/main/java/org/tribuo/SkeletalVariableInfo.java +++ b/Core/src/main/java/org/tribuo/SkeletalVariableInfo.java @@ -19,6 +19,8 @@ import java.util.Objects; import java.util.logging.Logger; +import org.tribuo.protos.ProtoSerializableField; + /** * Contains information about a feature and can be stored in the feature map * in a {@link Dataset}. @@ -31,11 +33,13 @@ public abstract class SkeletalVariableInfo implements VariableInfo { /** * The name of the feature. */ + @ProtoSerializableField protected final String name; /** * How often the feature occurs in the dataset. */ + @ProtoSerializableField protected int count; /** diff --git a/Core/src/main/java/org/tribuo/VariableInfo.java b/Core/src/main/java/org/tribuo/VariableInfo.java index 7ecc5ec4c..1a2c4c0ab 100644 --- a/Core/src/main/java/org/tribuo/VariableInfo.java +++ b/Core/src/main/java/org/tribuo/VariableInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,9 @@ package org.tribuo; +import org.tribuo.protos.ProtoSerializable; +import org.tribuo.protos.core.VariableInfoProto; + import java.io.Serializable; import java.util.SplittableRandom; @@ -23,7 +26,7 @@ * A VariableInfo subclass contains information about a feature and * its observed values. */ -public interface VariableInfo extends Serializable, Cloneable { +public interface VariableInfo extends Serializable, ProtoSerializable, Cloneable { /** * The name of this feature. * @return The feature name. diff --git a/Core/src/main/java/org/tribuo/hash/HashCodeHasher.java b/Core/src/main/java/org/tribuo/hash/HashCodeHasher.java index dd2d8b479..aa2f15fd6 100644 --- a/Core/src/main/java/org/tribuo/hash/HashCodeHasher.java +++ b/Core/src/main/java/org/tribuo/hash/HashCodeHasher.java @@ -16,23 +16,37 @@ package org.tribuo.hash; +import com.google.protobuf.Any; import com.oracle.labs.mlrg.olcut.config.Config; import com.oracle.labs.mlrg.olcut.config.PropertyException; import com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance; import com.oracle.labs.mlrg.olcut.provenance.Provenance; import com.oracle.labs.mlrg.olcut.provenance.primitives.StringProvenance; +import org.tribuo.protos.core.HasherProto; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoUtil; import java.io.IOException; import java.io.ObjectInputStream; import java.util.Collections; import java.util.Map; +import java.util.Objects; /** * Hashes names using String.hashCode(). + *

+ * HashCodeHasher does not serialize the salt in its serialized forms, and + * thus the salt must be set after deserialization. */ +@ProtoSerializableClass(version = HashCodeHasher.CURRENT_VERSION) public final class HashCodeHasher extends Hasher { private static final long serialVersionUID = 2L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + @Config(mandatory = true, redact = true, description="Salt used in the hash.") private transient String salt = null; @@ -52,6 +66,26 @@ public HashCodeHasher(String salt) { postConfig(); } + /** + * Deserialization factory. + *

+ * Note the salt must be set after the hasher has been deserialized. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + */ + public static HashCodeHasher deserializeFromProto(int version, String className, Any message) { + if (version < 0 || version > CURRENT_VERSION) { + throw new IllegalArgumentException("Unknown version " + version + ", this class supports at most version " + CURRENT_VERSION); + } + return new HashCodeHasher(); + } + + @Override + public HasherProto serialize() { + return ProtoUtil.serialize(this); + } + @Override public String hash(String name) { if (salt == null) { @@ -92,6 +126,23 @@ public String toString() { return "HashCodeHasher()"; } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HashCodeHasher that = (HashCodeHasher) o; + return Objects.equals(salt, that.salt); + } + + @Override + public int hashCode() { + return Objects.hash(salt); + } + private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); salt = null; diff --git a/Core/src/main/java/org/tribuo/hash/HashedFeatureMap.java b/Core/src/main/java/org/tribuo/hash/HashedFeatureMap.java index 9e53681a1..2ec6d5bb8 100644 --- a/Core/src/main/java/org/tribuo/hash/HashedFeatureMap.java +++ b/Core/src/main/java/org/tribuo/hash/HashedFeatureMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,19 @@ package org.tribuo.hash; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; import org.tribuo.FeatureMap; import org.tribuo.ImmutableFeatureMap; import org.tribuo.Model; import org.tribuo.VariableIDInfo; import org.tribuo.VariableInfo; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.HashedFeatureMapProto; +import org.tribuo.protos.core.HasherProto; +import org.tribuo.protos.core.VariableInfoProto; import java.util.Map; import java.util.TreeMap; @@ -30,10 +38,19 @@ * provide feature name hashing and guarantee that the {@link Model} * does not contain feature name information, but still works * with unhashed features names. + *

+ * The salt must be set after this object has been deserialized. */ +@ProtoSerializableClass(version = HashedFeatureMap.CURRENT_VERSION, serializedDataClass = HashedFeatureMapProto.class) public final class HashedFeatureMap extends ImmutableFeatureMap { private static final long serialVersionUID = 1L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + + @ProtoSerializableField private final Hasher hasher; private HashedFeatureMap(Hasher hasher) { @@ -41,6 +58,32 @@ private HashedFeatureMap(Hasher hasher) { this.hasher = hasher; } + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + */ + public static HashedFeatureMap deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + if (version < 0 || version > CURRENT_VERSION) { + throw new IllegalArgumentException("Unknown version " + version + ", this class supports at most version " + CURRENT_VERSION); + } + HashedFeatureMapProto proto = message.unpack(HashedFeatureMapProto.class); + HasherProto hasherProto = proto.getHasher(); + Hasher hasher = ProtoUtil.deserialize(hasherProto); + HashedFeatureMap obj = new HashedFeatureMap(hasher); + for (VariableInfoProto infoProto : proto.getInfoList()) { + VariableIDInfo info = ProtoUtil.deserialize(infoProto); + Object o = obj.idMap.put(info.getID(), info); + Object otherO = obj.m.put(info.getName(),info); + if ((o != null) || (otherO != null)) { + throw new IllegalStateException("Invalid protobuf, found two mappings for " + info.getName()); + } + } + obj.size = proto.getInfoCount(); + return obj; + } + @Override public VariableIDInfo get(String name) { String hash = hasher.hash(name); @@ -80,7 +123,7 @@ public void setSalt(String salt) { * This preserves the index ordering of the original feature names, * which is important for making sure test time performance is good. *

- * It guarantees any collisions will produce an feature id number lower + * It guarantees any collisions will produce a feature id number lower * than the previous feature's number, and so can be easily removed. * * @param map The {@link FeatureMap} to hash. diff --git a/Core/src/main/java/org/tribuo/hash/Hasher.java b/Core/src/main/java/org/tribuo/hash/Hasher.java index ba04d29e9..28f42b3ed 100644 --- a/Core/src/main/java/org/tribuo/hash/Hasher.java +++ b/Core/src/main/java/org/tribuo/hash/Hasher.java @@ -19,22 +19,30 @@ import com.oracle.labs.mlrg.olcut.config.Configurable; import com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance; import com.oracle.labs.mlrg.olcut.provenance.Provenancable; +import org.tribuo.protos.ProtoSerializable; +import org.tribuo.protos.core.HasherProto; import java.io.Serializable; /** * An abstract base class for hash functions used to hash the names of features. + *

+ * Hasher implementations do not serialize the salt in their serialized forms, and + * thus the salt must be set after deserialization. */ -public abstract class Hasher implements Configurable, Provenancable, Serializable { +public abstract class Hasher implements Configurable, Provenancable, Serializable, + ProtoSerializable { private static final long serialVersionUID = 2L; /** * The minimum length of the salt. Salts shorter than this will not validate. */ - public static final int MIN_LENGTH=8; + public static final int MIN_LENGTH = 8; /** * Hashes the supplied input using the hashing function. + *

+ * If the salt is not set then this throws {@link IllegalStateException}. * @param input The input to hash. * @return A String representation of the hashed output. */ diff --git a/Core/src/main/java/org/tribuo/hash/MessageDigestHasher.java b/Core/src/main/java/org/tribuo/hash/MessageDigestHasher.java index 78eae8fce..8e2d13fa6 100644 --- a/Core/src/main/java/org/tribuo/hash/MessageDigestHasher.java +++ b/Core/src/main/java/org/tribuo/hash/MessageDigestHasher.java @@ -16,12 +16,19 @@ package org.tribuo.hash; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; import com.oracle.labs.mlrg.olcut.config.Config; import com.oracle.labs.mlrg.olcut.config.PropertyException; import com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance; import com.oracle.labs.mlrg.olcut.provenance.ObjectProvenance; import com.oracle.labs.mlrg.olcut.provenance.Provenance; import com.oracle.labs.mlrg.olcut.provenance.primitives.StringProvenance; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.HasherProto; +import org.tribuo.protos.core.MessageDigestHasherProto; import java.io.IOException; import java.io.ObjectInputStream; @@ -29,6 +36,7 @@ import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; +import java.util.Arrays; import java.util.Base64; import java.util.HashMap; import java.util.Map; @@ -37,10 +45,19 @@ /** * Hashes Strings using the supplied MessageDigest type. + *

+ * MessageDigestHasher does not serialize the salt in its serialized forms, and + * thus the salt must be set after deserialization. */ +@ProtoSerializableClass(version = MessageDigestHasher.CURRENT_VERSION, serializedDataClass = MessageDigestHasherProto.class) public final class MessageDigestHasher extends Hasher { private static final long serialVersionUID = 3L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + /** * Alias for {@link StandardCharsets#UTF_8}. */ @@ -49,6 +66,7 @@ public final class MessageDigestHasher extends Hasher { static final String HASH_TYPE = "hashType"; @Config(mandatory = true,description="MessageDigest hashing function.") + @ProtoSerializableField private String hashType; private transient ThreadLocal md; @@ -84,6 +102,28 @@ public MessageDigestHasher(String hashType, String salt) { this.provenance = new MessageDigestHasherProvenance(hashType); } + /** + * Deserialization factory. + *

+ * Note the salt must be set after the hasher has been deserialized. + * @param version The serialized object version number. + * @param className The class name. + * @param message The serialized data. + * @throws InvalidProtocolBufferException If the message cannot be parsed by {@link MessageDigestHasherProto}. + */ + public static MessageDigestHasher deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + if (version < 0 || version > CURRENT_VERSION) { + throw new IllegalArgumentException("Unknown version " + version + ", this class supports at most version " + CURRENT_VERSION); + } + MessageDigestHasher obj = new MessageDigestHasher(); + MessageDigestHasherProto proto = message.unpack(MessageDigestHasherProto.class); + obj.hashType = proto.getHashType(); + obj.md = ThreadLocal.withInitial(getDigestSupplier(obj.hashType)); + MessageDigest d = obj.md.get(); // To trigger the unsupported digest exception. + obj.provenance = new MessageDigestHasherProvenance(obj.hashType); + return obj; + } + /** * Used by the OLCUT configuration system, and should not be called by external code. */ @@ -118,6 +158,11 @@ public String hash(String input) { return Base64.getEncoder().encodeToString(hash); } + @Override + public HasherProto serialize() { + return ProtoUtil.serialize(this); + } + @Override public void setSalt(String salt) { if (Hasher.validateSalt(salt)) { @@ -139,6 +184,25 @@ public String toString() { return "MessageDigestHasher(algorithm="+md.get().getAlgorithm()+")"; } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageDigestHasher that = (MessageDigestHasher) o; + return Objects.equals(hashType, that.hashType) && Arrays.equals(salt, that.salt); + } + + @Override + public int hashCode() { + int result = Objects.hash(hashType); + result = 31 * result + Arrays.hashCode(salt); + return result; + } + @Override public ConfiguredObjectProvenance getProvenance() { return provenance; diff --git a/Core/src/main/java/org/tribuo/hash/ModHashCodeHasher.java b/Core/src/main/java/org/tribuo/hash/ModHashCodeHasher.java index 3a671cf58..1008f3442 100644 --- a/Core/src/main/java/org/tribuo/hash/ModHashCodeHasher.java +++ b/Core/src/main/java/org/tribuo/hash/ModHashCodeHasher.java @@ -16,6 +16,8 @@ package org.tribuo.hash; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; import com.oracle.labs.mlrg.olcut.config.Config; import com.oracle.labs.mlrg.olcut.config.PropertyException; import com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance; @@ -23,6 +25,11 @@ import com.oracle.labs.mlrg.olcut.provenance.Provenance; import com.oracle.labs.mlrg.olcut.provenance.primitives.IntProvenance; import com.oracle.labs.mlrg.olcut.provenance.primitives.StringProvenance; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.HasherProto; +import org.tribuo.protos.core.ModHashCodeHasherProto; import java.io.IOException; import java.io.ObjectInputStream; @@ -32,15 +39,25 @@ /** * Hashes names using String.hashCode(), then reduces the dimension. + *

+ * ModHashCodeHasher does not serialize the salt in its serialized forms, and + * thus the salt must be set after deserialization. */ +@ProtoSerializableClass(version = ModHashCodeHasher.CURRENT_VERSION, serializedDataClass = ModHashCodeHasherProto.class) public final class ModHashCodeHasher extends Hasher { private static final long serialVersionUID = 2L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + static final String DIMENSION = "dimension"; @Config(mandatory = true,redact = true,description="Salt used in the hash.") private transient String salt = null; + @ProtoSerializableField @Config(mandatory = true,description="Range of the hashing function.") private int dimension = 100; @@ -70,6 +87,31 @@ public ModHashCodeHasher(int dimension, String salt) { postConfig(); } + /** + * Deserialization constructor. + *

+ * Note the salt must be set after the hasher has been deserialized. + * @param version The version number. + * @param className The class name. + * @param message The serialized data. + * @throws InvalidProtocolBufferException If the message cannot be parsed by {@link ModHashCodeHasherProto}. + */ + public static ModHashCodeHasher deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + if (version < 0 || version > CURRENT_VERSION) { + throw new IllegalArgumentException("Unknown version " + version + ", this class supports at most version " + CURRENT_VERSION); + } + ModHashCodeHasherProto proto = message.unpack(ModHashCodeHasherProto.class); + ModHashCodeHasher obj = new ModHashCodeHasher(); + obj.dimension = proto.getDimension(); + obj.provenance = new ModHashCodeHasherProvenance(obj.dimension); + return obj; + } + + @Override + public HasherProto serialize() { + return ProtoUtil.serialize(this); + } + /** * Used by the OLCUT configuration system, and should not be called by external code. */ @@ -111,6 +153,23 @@ public String toString() { return "ModHashCodeHasher(dimension=" + dimension + ")"; } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModHashCodeHasher that = (ModHashCodeHasher) o; + return dimension == that.dimension && Objects.equals(salt, that.salt); + } + + @Override + public int hashCode() { + return Objects.hash(salt, dimension); + } + private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); salt = null; diff --git a/Core/src/main/java/org/tribuo/hash/package-info.java b/Core/src/main/java/org/tribuo/hash/package-info.java index 1aa670a57..93ceded0c 100644 --- a/Core/src/main/java/org/tribuo/hash/package-info.java +++ b/Core/src/main/java/org/tribuo/hash/package-info.java @@ -24,5 +24,9 @@ * a specific range, and {@link org.tribuo.hash.MessageDigestHasher} which uses a * {@link java.security.MessageDigest} implementation to perform the hashing. Only MessageDigestHasher provides * security guarantees suitable for production usage. + *

+ * Note {@link org.tribuo.hash.Hasher} implementations require a salt which is serialized separately + * from the {@code Hasher} object. Without supplying this seed the hash methods will throw + * {@link java.lang.IllegalStateException}. */ package org.tribuo.hash; \ No newline at end of file diff --git a/Core/src/main/java/org/tribuo/protos/ProtoSerializable.java b/Core/src/main/java/org/tribuo/protos/ProtoSerializable.java new file mode 100644 index 000000000..b3d8da181 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/ProtoSerializable.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.tribuo.protos; + +import com.google.protobuf.Message; +import com.oracle.labs.mlrg.olcut.config.protobuf.ProtoProvenanceSerialization; + +/** + * Interface for serializing an implementing object to the specified protobuf. + *

+ * All classes which implement this interface must expose a static method called + * {@link ProtoSerializable#DESERIALIZATION_METHOD_NAME} which + * accepts three arguments (int version, String className, com.google.protobuf.Any message) + * and returns an instance of this class. + * We can't require this with the type system yet, so it must be checked by tests. + *

+ * The deserialization factory is accessed reflectively, and so if it is not public + * the module must be opened to the {@code org.tribuo.core} module. + * @param The protobuf type. + */ +public interface ProtoSerializable { + + /** + * Serializer used for provenance objects. + */ + public static final ProtoProvenanceSerialization PROVENANCE_SERIALIZER = new ProtoProvenanceSerialization(false); + + /** + * The name of the static deserialization method for {@link ProtoSerializable} classes. + */ + public static final String DESERIALIZATION_METHOD_NAME = "deserializeFromProto"; + + /** + * Serializes this object to a protobuf. + * @return The protobuf. + */ + public T serialize(); + +} diff --git a/Core/src/main/java/org/tribuo/protos/ProtoSerializableClass.java b/Core/src/main/java/org/tribuo/protos/ProtoSerializableClass.java new file mode 100644 index 000000000..8bbd4bd50 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/ProtoSerializableClass.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.tribuo.protos; + +import com.google.protobuf.Message; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; + +/** + * Mark a class as being {@link ProtoSerializable} and specify + * the class type used to serialize the "serialized_data". + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(TYPE) +public @interface ProtoSerializableClass { + /** + * Specifies the type of the serialized data payload. + * @return The proto class of the serialized data. + */ + Class serializedDataClass() default Message.class; + + /** + * The current version of this proto serialized class. + * @return The version number. + */ + int version(); +} diff --git a/Core/src/main/java/org/tribuo/protos/ProtoSerializableField.java b/Core/src/main/java/org/tribuo/protos/ProtoSerializableField.java new file mode 100644 index 000000000..9f2355577 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/ProtoSerializableField.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.tribuo.protos; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; + +/** + * Annotation which denotes that a field should be part of the protobuf serialized representation. + *

+ * Behaviour is undefined when used on a class which doesn't implement {@link ProtoSerializable}. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(FIELD) +public @interface ProtoSerializableField { + + /** + * The default field name, used to signify it should use the field name rather than a supplied value. + */ + public static final String DEFAULT_FIELD_NAME = "[DEFAULT_FIELD_NAME]"; + + /** + * The protobuf version when this field was added. + * @return The version. + */ + int sinceVersion() default 0; + + /** + * The name of the field in the protobuf in Java. + * @return The field name. + */ + String name() default DEFAULT_FIELD_NAME; +} diff --git a/Core/src/main/java/org/tribuo/protos/ProtoSerializableKeysValuesField.java b/Core/src/main/java/org/tribuo/protos/ProtoSerializableKeysValuesField.java new file mode 100644 index 000000000..91550a962 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/ProtoSerializableKeysValuesField.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.tribuo.protos; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; + +/** + * Annotation which denotes that the map field this is applied to is + * serialized as two repeated fields, one for keys and one for values. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(FIELD) +public @interface ProtoSerializableKeysValuesField { + /** + * The protobuf version when this field was added. + * @return The version. + */ + int sinceVersion() default 0; + + /** + * The name of the key field in the protobuf in Java. + * @return The key field name. + */ + String keysName(); + + /** + * The name of the value field in the protobuf in Java. + * @return The value field name. + */ + String valuesName(); +} diff --git a/Core/src/main/java/org/tribuo/protos/ProtoSerializableMapValuesField.java b/Core/src/main/java/org/tribuo/protos/ProtoSerializableMapValuesField.java new file mode 100644 index 000000000..b2ae444e4 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/ProtoSerializableMapValuesField.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.tribuo.protos; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; + +/** + * Annotation which denotes that the map field this is applied to is + * serialized as a list of values. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(FIELD) +public @interface ProtoSerializableMapValuesField { + /** + * The protobuf version when this field was added. + * @return The version. + */ + int sinceVersion() default 0; + + /** + * The name of the value field in the protobuf in Java. + * @return The value field name. + */ + String valuesName(); +} diff --git a/Core/src/main/java/org/tribuo/protos/ProtoUtil.java b/Core/src/main/java/org/tribuo/protos/ProtoUtil.java new file mode 100644 index 000000000..dac44b8ce --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/ProtoUtil.java @@ -0,0 +1,480 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.tribuo.protos; + +import com.google.protobuf.Any; +import com.google.protobuf.Descriptors.FieldDescriptor; +import com.google.protobuf.Message; +import com.oracle.labs.mlrg.olcut.util.MutableDouble; +import com.oracle.labs.mlrg.olcut.util.MutableLong; +import com.oracle.labs.mlrg.olcut.util.Pair; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.TypeVariable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +/** + * Utilities for working with Tribuo protobufs. + */ +public final class ProtoUtil { + private static final Logger logger = Logger.getLogger(ProtoUtil.class.getName()); + + /** + * Used to provide internal Tribuo redirects as classes are redefined. + *

+ * Must only be used for namespaces which are owned by Tribuo modules. + */ + private static final Map, String> REDIRECT_MAP = new HashMap<>(); + + /** + * Private final constructor for static utility class. + */ + private ProtoUtil() {} + + /** + * Instantiates the class from the supplied protobuf fields. + *

+ * Deserialization proceeds as follows: + *

    + *
  • Check to see if there is a valid redirect for this version & class name tuple. + * If there is then the new class name is used for the following steps.
  • + *
  • Lookup the class name and instantiate the {@link Class} object.
  • + *
  • Find the 3 arg static method {@code deserializeFromProto(int version, String className, com.google.protobuf.Any message)}.
  • + *
  • Call the method passing along the original three arguments (note this uses the + * original class name even if a redirect has been applied).
  • + *
  • Return the freshly constructed object, or rethrow any runtime exceptions.
  • + *
+ *

+ * Throws {@link IllegalStateException} if: + *

    + *
  • the requested class could not be found on the classpath/modulepath
  • + *
  • the requested class does not have the necessary 3 arg constructor
  • + *
  • the deserialization method could not be invoked due to its accessibility, or is in some other way invalid
  • + *
  • the deserialization method threw an exception
  • + *
+ * + * @param serialized The protobuf to deserialize. + * @param The protobuf type. + * @param The deserialized type. + * @return The deserialized object. + */ + public static > PROTO_SERIALIZABLE deserialize(SERIALIZED serialized) { + + // Extract version from serialized + FieldDescriptor fieldDescriptor = serialized.getDescriptorForType().findFieldByName("version"); + int version = (Integer) serialized.getField(fieldDescriptor); + // Extract class_name of return value from serialized + fieldDescriptor = serialized.getDescriptorForType().findFieldByName("class_name"); + // Allow redirect for Tribuo's classes. + String className = (String) serialized.getField(fieldDescriptor); + Pair key = new Pair<>(version, className); + String targetClassName = REDIRECT_MAP.getOrDefault(key, className); + + try { + @SuppressWarnings("unchecked") + Class protoSerializableClass = (Class) Class.forName(targetClassName); + + fieldDescriptor = serialized.getDescriptorForType().findFieldByName("serialized_data"); + Any serializedData = (Any) serialized.getField(fieldDescriptor); + + Method method = protoSerializableClass.getDeclaredMethod(ProtoSerializable.DESERIALIZATION_METHOD_NAME, int.class, String.class, Any.class); + method.setAccessible(true); + @SuppressWarnings("unchecked") + PROTO_SERIALIZABLE protoSerializable = (PROTO_SERIALIZABLE) method.invoke(null, version, targetClassName, serializedData); + method.setAccessible(false); + return protoSerializable; + } catch (ClassNotFoundException e) { + throw new IllegalStateException("Failed to find class " + targetClassName, e); + } catch (NoSuchMethodException e) { + throw new IllegalStateException("Failed to find deserialization method " + ProtoSerializable.DESERIALIZATION_METHOD_NAME + "(int, String, com.google.protobuf.Any) on class " + targetClassName, e); + } catch (IllegalAccessException e) { + throw new IllegalStateException("Failed to invoke deserialization method " + ProtoSerializable.DESERIALIZATION_METHOD_NAME + "(int, String, com.google.protobuf.Any) on class " + targetClassName, e); + } catch (InvocationTargetException e) { + throw new IllegalStateException("The deserialization method for " + ProtoSerializable.DESERIALIZATION_METHOD_NAME + "(int, String, com.google.protobuf.Any) on class " + targetClassName + " threw an exception", e); + } + } + + @SuppressWarnings("unchecked") + public static > SERIALIZED_CLASS serialize(PROTO_SERIALIZABLE protoSerializable) { + try { + ProtoSerializableClass annotation = protoSerializable.getClass().getAnnotation(ProtoSerializableClass.class); + if (annotation == null) { + throw new IllegalArgumentException("instance of ProtoSerializable must be annotated with @ProtoSerializableClass to be serialized with ProtoUtil.serialize()"); + } + + Class serializedClass = getSerializedClass(protoSerializable); + SERIALIZED_CLASS.Builder serializedClassBuilder = (SERIALIZED_CLASS.Builder) serializedClass.getMethod("newBuilder").invoke(null); + Class serializedClassBuilderClass = (Class) serializedClassBuilder.getClass(); + serializedClassBuilderClass.getMethod("setVersion", Integer.TYPE).invoke(serializedClassBuilder, annotation.version()); + serializedClassBuilderClass.getMethod("setClassName", String.class).invoke(serializedClassBuilder, protoSerializable.getClass().getName()); + + Class serializedDataClass = (Class) annotation.serializedDataClass(); + //the default value for ProtoSerializableClass.serializedDataClass is GeneratedMessageV3 which is how you can signal that + //there is no serialized data to be serialized. + if (serializedDataClass != Message.class) { + SERIALIZED_DATA.Builder serializedDataBuilder = (SERIALIZED_DATA.Builder) serializedDataClass.getMethod("newBuilder").invoke(null); + Class serializedDataBuilderClass = (Class) serializedDataBuilder.getClass(); + + for (Field field : getFields(protoSerializable.getClass())) { + field.setAccessible(true); + Object obj = field.get(protoSerializable); + + ProtoSerializableField protoSerializableField = field.getAnnotation(ProtoSerializableField.class); + if (protoSerializableField != null) { + String fieldName = protoSerializableField.name(); + if (fieldName.equals(ProtoSerializableField.DEFAULT_FIELD_NAME)) { + fieldName = field.getName(); + } + + Class fieldClazz = field.getType(); + String nameStub = (fieldClazz.isArray() || Collection.class.isAssignableFrom(fieldClazz)) ? "addAll" : "set"; + Method setter = findMethod(serializedDataBuilderClass, nameStub, fieldName, 1); + obj = convert(obj); + setter.setAccessible(true); + setter.invoke(serializedDataBuilder, obj); + setter.setAccessible(false); + } + + ProtoSerializableKeysValuesField pskvf = field.getAnnotation(ProtoSerializableKeysValuesField.class); + if (pskvf != null) { + if (!(obj instanceof Map) && (obj != null)) { + throw new IllegalStateException("Field of type " + obj.getClass() + " was annotated with ProtoSerializableKeysValuesField which is only supported on java.util.Map fields"); + } + Method keyAdder = findMethod(serializedDataBuilderClass, "add", pskvf.keysName(), 1); + keyAdder.setAccessible(true); + Method valueAdder = findMethod(serializedDataBuilderClass, "add", pskvf.valuesName(), 1); + valueAdder.setAccessible(true); + Map map = (Map) obj; + if (map != null) { + for (Map.Entry e : map.entrySet()) { + keyAdder.invoke(serializedDataBuilder, convert(e.getKey())); + valueAdder.invoke(serializedDataBuilder, convert(e.getValue())); + } + } + keyAdder.setAccessible(false); + valueAdder.setAccessible(false); + } + + ProtoSerializableMapValuesField psmvf = field.getAnnotation(ProtoSerializableMapValuesField.class); + if (psmvf != null) { + if (!(obj instanceof Map) && (obj != null)) { + throw new IllegalStateException("Field of type " + obj.getClass() + " was annotated with ProtoSerializableMapValuesField which is only supported on java.util.Map fields"); + } + Method valuesAdder = findMethod(serializedDataBuilderClass, "addAll", psmvf.valuesName(), 1); + obj = convertValues((Map) obj); + valuesAdder.setAccessible(true); + valuesAdder.invoke(serializedDataBuilder, obj); + valuesAdder.setAccessible(false); + } + + field.setAccessible(false); + } + serializedClassBuilderClass.getMethod("setSerializedData", com.google.protobuf.Any.class).invoke(serializedClassBuilder, Any.pack(serializedDataBuilder.build())); + } + return (SERIALIZED_CLASS) serializedClassBuilder.build(); + } catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) { + throw new RuntimeException(e); + } + } + + /** + * If this class is annotated with {@link ProtoSerializableClass} returns the + * version number, otherwise returns -1. + * + * @param clazz The class to check. + * @return The version number, or -1 if it does not use the annotation. + */ + public static int getCurrentVersion(Class> clazz) { + ProtoSerializableClass ann = clazz.getAnnotation(ProtoSerializableClass.class); + if (ann != null) { + return ann.version(); + } else { + return -1; + } + } + + static > Class getSerializedClass(PROTO_SERIALIZABLE protoSerializable) { + @SuppressWarnings("unchecked") + Class serializedClass = (Class) resolveTypeParameter(ProtoSerializable.class, protoSerializable.getClass(), ProtoSerializable.class.getTypeParameters()[0]); + if (serializedClass != null) { + return serializedClass; + } + String tpName = ProtoSerializable.class.getTypeParameters()[0].getName(); + throw new IllegalArgumentException("unable to resolve type parameter '" + tpName + "' in ProtoSerializable<" + tpName + "> for class " + protoSerializable.getClass().getName()); + } + + private static List convertValues(Map obj) { + List values = new ArrayList<>(); + for (Object value : obj.values()) { + values.add(convert(value)); + } + return values; + } + + private static Object convert(Object obj) { + if (obj instanceof ProtoSerializable) { + return ((ProtoSerializable) obj).serialize(); + } else if (obj instanceof MutableLong) { + return ((MutableLong) obj).longValue(); + } else if (obj instanceof MutableDouble) { + return ((MutableDouble) obj).doubleValue(); + } else if (obj.getClass().isEnum()) { + return ((Enum) obj).name(); + } else if (obj instanceof int[]) { + int[] t = (int[]) obj; + return Arrays.stream(t).boxed().collect(Collectors.toList()); + } else if (obj instanceof long[]) { + long[] t = (long[]) obj; + return Arrays.stream(t).boxed().collect(Collectors.toList()); + } else if (obj instanceof float[]) { + float[] t = (float[]) obj; + List floats = new ArrayList<>(); + for (float f : t) { + floats.add(f); + } + return floats; + } else if (obj instanceof double[]) { + double[] t = (double[]) obj; + return Arrays.stream(t).boxed().collect(Collectors.toList()); + } else if (obj instanceof String[]) { + return Arrays.asList((String[]) obj); + } else if (obj instanceof Double || obj instanceof Float || obj instanceof Byte || obj instanceof Short || obj instanceof Character || obj instanceof Integer || obj instanceof Long || obj instanceof Boolean || obj instanceof String) { + return obj; + } else { + throw new IllegalArgumentException("Invalid protobuf field type " + obj.getClass()); + } + } + + private static List getFields(Class clazz) { + Set fieldNameSet = new HashSet<>(); + List fields = new ArrayList<>(); + getFields(clazz, fieldNameSet, fields); + return fields; + } + + private static void getFields(Class clazz, Set fieldNameSet, List fields) { + for (Field field : clazz.getDeclaredFields()) { + ProtoSerializableField psf = field.getAnnotation(ProtoSerializableField.class); + ProtoSerializableKeysValuesField pskvf = field.getAnnotation(ProtoSerializableKeysValuesField.class); + ProtoSerializableMapValuesField psmvf = field.getAnnotation(ProtoSerializableMapValuesField.class); + if ((psf != null) && (pskvf == null) && (psmvf == null)) { + String protoFieldName; + if (psf.equals(ProtoSerializableField.DEFAULT_FIELD_NAME)) { + protoFieldName = field.getName(); + } else { + protoFieldName = psf.name(); + } + if (!fieldNameSet.contains(protoFieldName)) { + fields.add(field); + fieldNameSet.add(field.getName()); + } else { + logger.warning("Duplicate field named " + protoFieldName + " detected in class " + clazz); + } + } else if ((psf == null) && (pskvf != null) && (psmvf == null)) { + String keyName = pskvf.keysName(); + String valueName = pskvf.valuesName(); + if (fieldNameSet.contains(keyName) && fieldNameSet.contains(valueName)) { + continue; + } + if (fieldNameSet.contains(keyName) || fieldNameSet.contains(valueName)) { + throw new IllegalStateException("ProtoSerializableKeysValuesField on " + clazz.getName() + "." + field.getName() + " collides with another ProtoSerializable annotation"); + } + fields.add(field); + fieldNameSet.add(keyName); + fieldNameSet.add(valueName); + } else if ((psf == null) && (pskvf == null) && (psmvf != null)) { + String valuesName = psmvf.valuesName(); + if (!fieldNameSet.contains(valuesName)) { + fields.add(field); + fieldNameSet.add(valuesName); + } + } else if ((psf != null) || (pskvf != null) || (psmvf != null)) { + String message = "Multiple ProtoSerializable annotations applied to the same field, found " + + "ProtoSerializableField = " + psf + + ", ProtoSerializableKeysValuesField = " + pskvf + + ", ProtoSerializableMapValuesField = " + psmvf + + " on field named " + field.getName() + " of class " + clazz; + throw new IllegalStateException(message); + } + } + + Class superclass = clazz.getSuperclass(); + if (superclass != null && !superclass.equals(Object.class)) { + getFields(superclass, fieldNameSet, fields); + } + } + + private static Method findMethod(Class serializedDataBuilderClass, String prefixName, String fieldName, int expectedParamCount) { + String methodName = generateMethodName(prefixName, fieldName); + + for (Method method : serializedDataBuilderClass.getMethods()) { + if (method.getName().equals(methodName)) { + if (method.getParameterTypes().length != expectedParamCount) { + continue; + } + if (expectedParamCount == 0) { + return method; + } + Class clazz = method.getParameterTypes()[0]; + if (Message.Builder.class.isAssignableFrom(clazz)) { + continue; + } + return method; + } + } + throw new IllegalArgumentException("Unable to find method " + methodName + " for field name: " + fieldName + " in class: " + + serializedDataBuilderClass.getName()); + } + + public static String generateMethodName(String prefix, String name) { + StringBuilder sb = new StringBuilder(); + sb.append(prefix); + sb.append(("" + name.charAt(0)).toUpperCase()); + sb.append(name.substring(1)); + return sb.toString(); + } + + /** + * @param the type of the generic interface + * @param the type of the subclass we are trying to resolve the parameter for + * @param intrface a generically typed interface/class that has a type parameter that we want to resolve + * @param clazz a subclass of intrface that we to resolve the type parameter for (if possible) + * @param typeVariable the type variable/parameter that we want resolved (e.g. the type variable corresponding to <T>) + * @return null if the type parameter has not been resolved, otherwise the class type of the type parameter for the provided class. + */ + private static Class resolveTypeParameter(Class intrface, Class clazz, TypeVariable typeVariable) { + return resolveTypeParameter(intrface, clazz, new MutableTypeVariable(typeVariable)); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + private static Class resolveTypeParameter(Class intrface, Class clazz, MutableTypeVariable typeVariable) { + //go up the class hierarchy until super class is no longer assignable to the interface + Class superClass = clazz.getSuperclass(); + if (superClass != null && intrface.isAssignableFrom(superClass)) { + Class serializedClass = resolveTypeParameter(intrface, superClass, typeVariable); + if (serializedClass != null) { + return serializedClass; + } + } + //go up the interfaces hierarchy - but only those assignable to the interface + for (Class iface : clazz.getInterfaces()) { + if (intrface.isAssignableFrom(iface) && !intrface.equals(iface)) { + Class serializedClass = resolveTypeParameter(intrface, iface, typeVariable); + if (serializedClass != null) { + return serializedClass; + } + } + } + + //get all the generic supertypes that are parameterized types (but only those + //assignable to the interface) + List pts = getGenericSuperParameterizedTypes(intrface, clazz); + + //loop over each and get the type of the type variable for the typed generic interface + for (ParameterizedType genericInterface : pts) { + Type t = getParameterType(genericInterface, typeVariable.var); + //if the resulting type is another type variable, then we need to update the + //type variable that we are trying to match against + if (t instanceof TypeVariable) { + typeVariable.var = (TypeVariable) t; + } + //otherwise, we are done and we can return the class type of the type variable. + else if (t instanceof Class) { + return (Class) t; + } + } + + return null; + } + + /** + * Puts the generic superclass and generic interfaces into a single list + * to make it easy to iterate over each in a single collection. All + * returned values will be of type ParameterizedType and assignable to the + * intface (i.e. subclass sub-interface). + * + * @param clazz the class definition to find the generic parameterized types for. + * @return + */ + private static List getGenericSuperParameterizedTypes(Class intrface, Class clazz) { + List pts = new ArrayList<>(); + Type genericSuperclass = clazz.getGenericSuperclass(); + if (genericSuperclass instanceof ParameterizedType) { + pts.add((ParameterizedType) genericSuperclass); + } + for (Type genericInterface : clazz.getGenericInterfaces()) { + if (genericInterface instanceof ParameterizedType) { + ParameterizedType pt = (ParameterizedType) genericInterface; + if (intrface.isAssignableFrom((Class) pt.getRawType())) { + pts.add((ParameterizedType) genericInterface); + } + } + } + return pts; + } + + /** + * a class or type variable corresponding to the parameterized type's parameter + * type for the given type variable The returned type will either be a class if + * specified or another type variable if not. + * + * @param parameterizedType either a generic superclass or a generic interface + * @param typeVariable a type variable corresponding to e.g. <T> + * @return a class or type variable corresponding to the parameterized type's + * parameter type for the given type variable + */ + @SuppressWarnings("rawtypes") + private static Type getParameterType(ParameterizedType parameterizedType, TypeVariable typeVariable) { + Type rawType = parameterizedType.getRawType(); + if (rawType instanceof Class) { + TypeVariable[] typeParameters = ((Class) rawType).getTypeParameters(); + Type[] actualTypeArguments = parameterizedType.getActualTypeArguments(); + if (typeParameters.length == actualTypeArguments.length) { + for (int i = 0; i < typeParameters.length; i++) { + TypeVariable tp = typeParameters[i]; + if (tp.getName().equals(typeVariable.getName())) { + Type actualTypeArgument = actualTypeArguments[i]; + return actualTypeArgument; + } + } + } + } + return null; + } + + private static final class MutableTypeVariable { + private TypeVariable var; + + MutableTypeVariable(TypeVariable var) { + this.var = var; + } + } + +} diff --git a/Core/src/main/java/org/tribuo/protos/core/BinningTransformerProto.java b/Core/src/main/java/org/tribuo/protos/core/BinningTransformerProto.java new file mode 100644 index 000000000..34878ac13 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/BinningTransformerProto.java @@ -0,0 +1,917 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *BinningTransformer proto
+ * 
+ * + * Protobuf type {@code tribuo.core.BinningTransformerProto} + */ +public final class BinningTransformerProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.BinningTransformerProto) + BinningTransformerProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use BinningTransformerProto.newBuilder() to construct. + private BinningTransformerProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private BinningTransformerProto() { + binningType_ = ""; + bins_ = emptyDoubleList(); + values_ = emptyDoubleList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new BinningTransformerProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private BinningTransformerProto( + 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: { + java.lang.String s = input.readStringRequireUtf8(); + + binningType_ = s; + break; + } + case 17: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + bins_ = newDoubleList(); + mutable_bitField0_ |= 0x00000001; + } + bins_.addDouble(input.readDouble()); + break; + } + case 18: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) { + bins_ = newDoubleList(); + mutable_bitField0_ |= 0x00000001; + } + while (input.getBytesUntilLimit() > 0) { + bins_.addDouble(input.readDouble()); + } + input.popLimit(limit); + break; + } + case 25: { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + values_ = newDoubleList(); + mutable_bitField0_ |= 0x00000002; + } + values_.addDouble(input.readDouble()); + break; + } + case 26: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) { + values_ = newDoubleList(); + mutable_bitField0_ |= 0x00000002; + } + while (input.getBytesUntilLimit() > 0) { + values_.addDouble(input.readDouble()); + } + input.popLimit(limit); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + bins_.makeImmutable(); // C + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + values_.makeImmutable(); // C + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_BinningTransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_BinningTransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.BinningTransformerProto.class, org.tribuo.protos.core.BinningTransformerProto.Builder.class); + } + + public static final int BINNING_TYPE_FIELD_NUMBER = 1; + private volatile java.lang.Object binningType_; + /** + * string binning_type = 1; + * @return The binningType. + */ + @java.lang.Override + public java.lang.String getBinningType() { + java.lang.Object ref = binningType_; + 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(); + binningType_ = s; + return s; + } + } + /** + * string binning_type = 1; + * @return The bytes for binningType. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getBinningTypeBytes() { + java.lang.Object ref = binningType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + binningType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BINS_FIELD_NUMBER = 2; + private com.google.protobuf.Internal.DoubleList bins_; + /** + * repeated double bins = 2; + * @return A list containing the bins. + */ + @java.lang.Override + public java.util.List + getBinsList() { + return bins_; + } + /** + * repeated double bins = 2; + * @return The count of bins. + */ + public int getBinsCount() { + return bins_.size(); + } + /** + * repeated double bins = 2; + * @param index The index of the element to return. + * @return The bins at the given index. + */ + public double getBins(int index) { + return bins_.getDouble(index); + } + private int binsMemoizedSerializedSize = -1; + + public static final int VALUES_FIELD_NUMBER = 3; + private com.google.protobuf.Internal.DoubleList values_; + /** + * repeated double values = 3; + * @return A list containing the values. + */ + @java.lang.Override + public java.util.List + getValuesList() { + return values_; + } + /** + * repeated double values = 3; + * @return The count of values. + */ + public int getValuesCount() { + return values_.size(); + } + /** + * repeated double values = 3; + * @param index The index of the element to return. + * @return The values at the given index. + */ + public double getValues(int index) { + return values_.getDouble(index); + } + private int valuesMemoizedSerializedSize = -1; + + 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(binningType_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, binningType_); + } + if (getBinsList().size() > 0) { + output.writeUInt32NoTag(18); + output.writeUInt32NoTag(binsMemoizedSerializedSize); + } + for (int i = 0; i < bins_.size(); i++) { + output.writeDoubleNoTag(bins_.getDouble(i)); + } + if (getValuesList().size() > 0) { + output.writeUInt32NoTag(26); + output.writeUInt32NoTag(valuesMemoizedSerializedSize); + } + for (int i = 0; i < values_.size(); i++) { + output.writeDoubleNoTag(values_.getDouble(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(binningType_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, binningType_); + } + { + int dataSize = 0; + dataSize = 8 * getBinsList().size(); + size += dataSize; + if (!getBinsList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + binsMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * getValuesList().size(); + size += dataSize; + if (!getValuesList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + valuesMemoizedSerializedSize = dataSize; + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.tribuo.protos.core.BinningTransformerProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.BinningTransformerProto other = (org.tribuo.protos.core.BinningTransformerProto) obj; + + if (!getBinningType() + .equals(other.getBinningType())) return false; + if (!getBinsList() + .equals(other.getBinsList())) return false; + if (!getValuesList() + .equals(other.getValuesList())) 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) + BINNING_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getBinningType().hashCode(); + if (getBinsCount() > 0) { + hash = (37 * hash) + BINS_FIELD_NUMBER; + hash = (53 * hash) + getBinsList().hashCode(); + } + if (getValuesCount() > 0) { + hash = (37 * hash) + VALUES_FIELD_NUMBER; + hash = (53 * hash) + getValuesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.BinningTransformerProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.BinningTransformerProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.BinningTransformerProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.BinningTransformerProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.BinningTransformerProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.BinningTransformerProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.BinningTransformerProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.BinningTransformerProto 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 org.tribuo.protos.core.BinningTransformerProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.BinningTransformerProto 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 org.tribuo.protos.core.BinningTransformerProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.BinningTransformerProto 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(org.tribuo.protos.core.BinningTransformerProto 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; + } + /** + *
+   *BinningTransformer proto
+   * 
+ * + * Protobuf type {@code tribuo.core.BinningTransformerProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.BinningTransformerProto) + org.tribuo.protos.core.BinningTransformerProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_BinningTransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_BinningTransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.BinningTransformerProto.class, org.tribuo.protos.core.BinningTransformerProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.BinningTransformerProto.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(); + binningType_ = ""; + + bins_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000001); + values_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_BinningTransformerProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.BinningTransformerProto getDefaultInstanceForType() { + return org.tribuo.protos.core.BinningTransformerProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.BinningTransformerProto build() { + org.tribuo.protos.core.BinningTransformerProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.BinningTransformerProto buildPartial() { + org.tribuo.protos.core.BinningTransformerProto result = new org.tribuo.protos.core.BinningTransformerProto(this); + int from_bitField0_ = bitField0_; + result.binningType_ = binningType_; + if (((bitField0_ & 0x00000001) != 0)) { + bins_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.bins_ = bins_; + if (((bitField0_ & 0x00000002) != 0)) { + values_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.values_ = values_; + 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 org.tribuo.protos.core.BinningTransformerProto) { + return mergeFrom((org.tribuo.protos.core.BinningTransformerProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.BinningTransformerProto other) { + if (other == org.tribuo.protos.core.BinningTransformerProto.getDefaultInstance()) return this; + if (!other.getBinningType().isEmpty()) { + binningType_ = other.binningType_; + onChanged(); + } + if (!other.bins_.isEmpty()) { + if (bins_.isEmpty()) { + bins_ = other.bins_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureBinsIsMutable(); + bins_.addAll(other.bins_); + } + onChanged(); + } + if (!other.values_.isEmpty()) { + if (values_.isEmpty()) { + values_ = other.values_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureValuesIsMutable(); + values_.addAll(other.values_); + } + 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 { + org.tribuo.protos.core.BinningTransformerProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.BinningTransformerProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.lang.Object binningType_ = ""; + /** + * string binning_type = 1; + * @return The binningType. + */ + public java.lang.String getBinningType() { + java.lang.Object ref = binningType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + binningType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string binning_type = 1; + * @return The bytes for binningType. + */ + public com.google.protobuf.ByteString + getBinningTypeBytes() { + java.lang.Object ref = binningType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + binningType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string binning_type = 1; + * @param value The binningType to set. + * @return This builder for chaining. + */ + public Builder setBinningType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + binningType_ = value; + onChanged(); + return this; + } + /** + * string binning_type = 1; + * @return This builder for chaining. + */ + public Builder clearBinningType() { + + binningType_ = getDefaultInstance().getBinningType(); + onChanged(); + return this; + } + /** + * string binning_type = 1; + * @param value The bytes for binningType to set. + * @return This builder for chaining. + */ + public Builder setBinningTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + binningType_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Internal.DoubleList bins_ = emptyDoubleList(); + private void ensureBinsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + bins_ = mutableCopy(bins_); + bitField0_ |= 0x00000001; + } + } + /** + * repeated double bins = 2; + * @return A list containing the bins. + */ + public java.util.List + getBinsList() { + return ((bitField0_ & 0x00000001) != 0) ? + java.util.Collections.unmodifiableList(bins_) : bins_; + } + /** + * repeated double bins = 2; + * @return The count of bins. + */ + public int getBinsCount() { + return bins_.size(); + } + /** + * repeated double bins = 2; + * @param index The index of the element to return. + * @return The bins at the given index. + */ + public double getBins(int index) { + return bins_.getDouble(index); + } + /** + * repeated double bins = 2; + * @param index The index to set the value at. + * @param value The bins to set. + * @return This builder for chaining. + */ + public Builder setBins( + int index, double value) { + ensureBinsIsMutable(); + bins_.setDouble(index, value); + onChanged(); + return this; + } + /** + * repeated double bins = 2; + * @param value The bins to add. + * @return This builder for chaining. + */ + public Builder addBins(double value) { + ensureBinsIsMutable(); + bins_.addDouble(value); + onChanged(); + return this; + } + /** + * repeated double bins = 2; + * @param values The bins to add. + * @return This builder for chaining. + */ + public Builder addAllBins( + java.lang.Iterable values) { + ensureBinsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, bins_); + onChanged(); + return this; + } + /** + * repeated double bins = 2; + * @return This builder for chaining. + */ + public Builder clearBins() { + bins_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.DoubleList values_ = emptyDoubleList(); + private void ensureValuesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + values_ = mutableCopy(values_); + bitField0_ |= 0x00000002; + } + } + /** + * repeated double values = 3; + * @return A list containing the values. + */ + public java.util.List + getValuesList() { + return ((bitField0_ & 0x00000002) != 0) ? + java.util.Collections.unmodifiableList(values_) : values_; + } + /** + * repeated double values = 3; + * @return The count of values. + */ + public int getValuesCount() { + return values_.size(); + } + /** + * repeated double values = 3; + * @param index The index of the element to return. + * @return The values at the given index. + */ + public double getValues(int index) { + return values_.getDouble(index); + } + /** + * repeated double values = 3; + * @param index The index to set the value at. + * @param value The values to set. + * @return This builder for chaining. + */ + public Builder setValues( + int index, double value) { + ensureValuesIsMutable(); + values_.setDouble(index, value); + onChanged(); + return this; + } + /** + * repeated double values = 3; + * @param value The values to add. + * @return This builder for chaining. + */ + public Builder addValues(double value) { + ensureValuesIsMutable(); + values_.addDouble(value); + onChanged(); + return this; + } + /** + * repeated double values = 3; + * @param values The values to add. + * @return This builder for chaining. + */ + public Builder addAllValues( + java.lang.Iterable values) { + ensureValuesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, values_); + onChanged(); + return this; + } + /** + * repeated double values = 3; + * @return This builder for chaining. + */ + public Builder clearValues() { + values_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000002); + 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:tribuo.core.BinningTransformerProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.BinningTransformerProto) + private static final org.tribuo.protos.core.BinningTransformerProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.BinningTransformerProto(); + } + + public static org.tribuo.protos.core.BinningTransformerProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BinningTransformerProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BinningTransformerProto(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 org.tribuo.protos.core.BinningTransformerProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/BinningTransformerProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/BinningTransformerProtoOrBuilder.java new file mode 100644 index 000000000..89e10c836 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/BinningTransformerProtoOrBuilder.java @@ -0,0 +1,55 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface BinningTransformerProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.BinningTransformerProto) + com.google.protobuf.MessageOrBuilder { + + /** + * string binning_type = 1; + * @return The binningType. + */ + java.lang.String getBinningType(); + /** + * string binning_type = 1; + * @return The bytes for binningType. + */ + com.google.protobuf.ByteString + getBinningTypeBytes(); + + /** + * repeated double bins = 2; + * @return A list containing the bins. + */ + java.util.List getBinsList(); + /** + * repeated double bins = 2; + * @return The count of bins. + */ + int getBinsCount(); + /** + * repeated double bins = 2; + * @param index The index of the element to return. + * @return The bins at the given index. + */ + double getBins(int index); + + /** + * repeated double values = 3; + * @return A list containing the values. + */ + java.util.List getValuesList(); + /** + * repeated double values = 3; + * @return The count of values. + */ + int getValuesCount(); + /** + * repeated double values = 3; + * @param index The index of the element to return. + * @return The values at the given index. + */ + double getValues(int index); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/CategoricalIDInfoProto.java b/Core/src/main/java/org/tribuo/protos/core/CategoricalIDInfoProto.java new file mode 100644 index 000000000..9d6b06a98 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/CategoricalIDInfoProto.java @@ -0,0 +1,1179 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *CategoricalIDInfo proto
+ * 
+ * + * Protobuf type {@code tribuo.core.CategoricalIDInfoProto} + */ +public final class CategoricalIDInfoProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.CategoricalIDInfoProto) + CategoricalIDInfoProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use CategoricalIDInfoProto.newBuilder() to construct. + private CategoricalIDInfoProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private CategoricalIDInfoProto() { + name_ = ""; + key_ = emptyDoubleList(); + value_ = emptyLongList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new CategoricalIDInfoProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CategoricalIDInfoProto( + 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: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 16: { + + count_ = input.readInt32(); + break; + } + case 24: { + + id_ = input.readInt32(); + break; + } + case 81: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + key_ = newDoubleList(); + mutable_bitField0_ |= 0x00000001; + } + key_.addDouble(input.readDouble()); + break; + } + case 82: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) { + key_ = newDoubleList(); + mutable_bitField0_ |= 0x00000001; + } + while (input.getBytesUntilLimit() > 0) { + key_.addDouble(input.readDouble()); + } + input.popLimit(limit); + break; + } + case 88: { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + value_ = newLongList(); + mutable_bitField0_ |= 0x00000002; + } + value_.addLong(input.readInt64()); + break; + } + case 90: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) { + value_ = newLongList(); + mutable_bitField0_ |= 0x00000002; + } + while (input.getBytesUntilLimit() > 0) { + value_.addLong(input.readInt64()); + } + input.popLimit(limit); + break; + } + case 97: { + + observedValue_ = input.readDouble(); + break; + } + case 104: { + + observedCount_ = input.readInt64(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + key_.makeImmutable(); // C + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + value_.makeImmutable(); // C + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_CategoricalIDInfoProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_CategoricalIDInfoProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.CategoricalIDInfoProto.class, org.tribuo.protos.core.CategoricalIDInfoProto.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * string name = 1; + * @return The name. + */ + @java.lang.Override + 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 = 1; + * @return The bytes for name. + */ + @java.lang.Override + 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; + } + } + + public static final int COUNT_FIELD_NUMBER = 2; + private int count_; + /** + * int32 count = 2; + * @return The count. + */ + @java.lang.Override + public int getCount() { + return count_; + } + + public static final int ID_FIELD_NUMBER = 3; + private int id_; + /** + * int32 id = 3; + * @return The id. + */ + @java.lang.Override + public int getId() { + return id_; + } + + public static final int KEY_FIELD_NUMBER = 10; + private com.google.protobuf.Internal.DoubleList key_; + /** + * repeated double key = 10; + * @return A list containing the key. + */ + @java.lang.Override + public java.util.List + getKeyList() { + return key_; + } + /** + * repeated double key = 10; + * @return The count of key. + */ + public int getKeyCount() { + return key_.size(); + } + /** + * repeated double key = 10; + * @param index The index of the element to return. + * @return The key at the given index. + */ + public double getKey(int index) { + return key_.getDouble(index); + } + private int keyMemoizedSerializedSize = -1; + + public static final int VALUE_FIELD_NUMBER = 11; + private com.google.protobuf.Internal.LongList value_; + /** + * repeated int64 value = 11; + * @return A list containing the value. + */ + @java.lang.Override + public java.util.List + getValueList() { + return value_; + } + /** + * repeated int64 value = 11; + * @return The count of value. + */ + public int getValueCount() { + return value_.size(); + } + /** + * repeated int64 value = 11; + * @param index The index of the element to return. + * @return The value at the given index. + */ + public long getValue(int index) { + return value_.getLong(index); + } + private int valueMemoizedSerializedSize = -1; + + public static final int OBSERVED_VALUE_FIELD_NUMBER = 12; + private double observedValue_; + /** + * double observed_value = 12; + * @return The observedValue. + */ + @java.lang.Override + public double getObservedValue() { + return observedValue_; + } + + public static final int OBSERVED_COUNT_FIELD_NUMBER = 13; + private long observedCount_; + /** + * int64 observed_count = 13; + * @return The observedCount. + */ + @java.lang.Override + public long getObservedCount() { + return observedCount_; + } + + 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (count_ != 0) { + output.writeInt32(2, count_); + } + if (id_ != 0) { + output.writeInt32(3, id_); + } + if (getKeyList().size() > 0) { + output.writeUInt32NoTag(82); + output.writeUInt32NoTag(keyMemoizedSerializedSize); + } + for (int i = 0; i < key_.size(); i++) { + output.writeDoubleNoTag(key_.getDouble(i)); + } + if (getValueList().size() > 0) { + output.writeUInt32NoTag(90); + output.writeUInt32NoTag(valueMemoizedSerializedSize); + } + for (int i = 0; i < value_.size(); i++) { + output.writeInt64NoTag(value_.getLong(i)); + } + if (java.lang.Double.doubleToRawLongBits(observedValue_) != 0) { + output.writeDouble(12, observedValue_); + } + if (observedCount_ != 0L) { + output.writeInt64(13, observedCount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (count_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, count_); + } + if (id_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, id_); + } + { + int dataSize = 0; + dataSize = 8 * getKeyList().size(); + size += dataSize; + if (!getKeyList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + keyMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < value_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeInt64SizeNoTag(value_.getLong(i)); + } + size += dataSize; + if (!getValueList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + valueMemoizedSerializedSize = dataSize; + } + if (java.lang.Double.doubleToRawLongBits(observedValue_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(12, observedValue_); + } + if (observedCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(13, observedCount_); + } + 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 org.tribuo.protos.core.CategoricalIDInfoProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.CategoricalIDInfoProto other = (org.tribuo.protos.core.CategoricalIDInfoProto) obj; + + if (!getName() + .equals(other.getName())) return false; + if (getCount() + != other.getCount()) return false; + if (getId() + != other.getId()) return false; + if (!getKeyList() + .equals(other.getKeyList())) return false; + if (!getValueList() + .equals(other.getValueList())) return false; + if (java.lang.Double.doubleToLongBits(getObservedValue()) + != java.lang.Double.doubleToLongBits( + other.getObservedValue())) return false; + if (getObservedCount() + != other.getObservedCount()) 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) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + COUNT_FIELD_NUMBER; + hash = (53 * hash) + getCount(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId(); + if (getKeyCount() > 0) { + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKeyList().hashCode(); + } + if (getValueCount() > 0) { + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValueList().hashCode(); + } + hash = (37 * hash) + OBSERVED_VALUE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getObservedValue())); + hash = (37 * hash) + OBSERVED_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getObservedCount()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.CategoricalIDInfoProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.CategoricalIDInfoProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.CategoricalIDInfoProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.CategoricalIDInfoProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.CategoricalIDInfoProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.CategoricalIDInfoProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.CategoricalIDInfoProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.CategoricalIDInfoProto 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 org.tribuo.protos.core.CategoricalIDInfoProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.CategoricalIDInfoProto 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 org.tribuo.protos.core.CategoricalIDInfoProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.CategoricalIDInfoProto 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(org.tribuo.protos.core.CategoricalIDInfoProto 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; + } + /** + *
+   *CategoricalIDInfo proto
+   * 
+ * + * Protobuf type {@code tribuo.core.CategoricalIDInfoProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.CategoricalIDInfoProto) + org.tribuo.protos.core.CategoricalIDInfoProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_CategoricalIDInfoProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_CategoricalIDInfoProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.CategoricalIDInfoProto.class, org.tribuo.protos.core.CategoricalIDInfoProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.CategoricalIDInfoProto.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(); + name_ = ""; + + count_ = 0; + + id_ = 0; + + key_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000001); + value_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000002); + observedValue_ = 0D; + + observedCount_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_CategoricalIDInfoProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.CategoricalIDInfoProto getDefaultInstanceForType() { + return org.tribuo.protos.core.CategoricalIDInfoProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.CategoricalIDInfoProto build() { + org.tribuo.protos.core.CategoricalIDInfoProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.CategoricalIDInfoProto buildPartial() { + org.tribuo.protos.core.CategoricalIDInfoProto result = new org.tribuo.protos.core.CategoricalIDInfoProto(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.count_ = count_; + result.id_ = id_; + if (((bitField0_ & 0x00000001) != 0)) { + key_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.key_ = key_; + if (((bitField0_ & 0x00000002) != 0)) { + value_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.value_ = value_; + result.observedValue_ = observedValue_; + result.observedCount_ = observedCount_; + 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 org.tribuo.protos.core.CategoricalIDInfoProto) { + return mergeFrom((org.tribuo.protos.core.CategoricalIDInfoProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.CategoricalIDInfoProto other) { + if (other == org.tribuo.protos.core.CategoricalIDInfoProto.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getCount() != 0) { + setCount(other.getCount()); + } + if (other.getId() != 0) { + setId(other.getId()); + } + if (!other.key_.isEmpty()) { + if (key_.isEmpty()) { + key_ = other.key_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureKeyIsMutable(); + key_.addAll(other.key_); + } + onChanged(); + } + if (!other.value_.isEmpty()) { + if (value_.isEmpty()) { + value_ = other.value_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureValueIsMutable(); + value_.addAll(other.value_); + } + onChanged(); + } + if (other.getObservedValue() != 0D) { + setObservedValue(other.getObservedValue()); + } + if (other.getObservedCount() != 0L) { + setObservedCount(other.getObservedCount()); + } + 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 { + org.tribuo.protos.core.CategoricalIDInfoProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.CategoricalIDInfoProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * string name = 1; + * @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 = 1; + * @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 = 1; + * @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 = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * string name = 1; + * @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; + } + + private int count_ ; + /** + * int32 count = 2; + * @return The count. + */ + @java.lang.Override + public int getCount() { + return count_; + } + /** + * int32 count = 2; + * @param value The count to set. + * @return This builder for chaining. + */ + public Builder setCount(int value) { + + count_ = value; + onChanged(); + return this; + } + /** + * int32 count = 2; + * @return This builder for chaining. + */ + public Builder clearCount() { + + count_ = 0; + onChanged(); + return this; + } + + private int id_ ; + /** + * int32 id = 3; + * @return The id. + */ + @java.lang.Override + public int getId() { + return id_; + } + /** + * int32 id = 3; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId(int value) { + + id_ = value; + onChanged(); + return this; + } + /** + * int32 id = 3; + * @return This builder for chaining. + */ + public Builder clearId() { + + id_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Internal.DoubleList key_ = emptyDoubleList(); + private void ensureKeyIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + key_ = mutableCopy(key_); + bitField0_ |= 0x00000001; + } + } + /** + * repeated double key = 10; + * @return A list containing the key. + */ + public java.util.List + getKeyList() { + return ((bitField0_ & 0x00000001) != 0) ? + java.util.Collections.unmodifiableList(key_) : key_; + } + /** + * repeated double key = 10; + * @return The count of key. + */ + public int getKeyCount() { + return key_.size(); + } + /** + * repeated double key = 10; + * @param index The index of the element to return. + * @return The key at the given index. + */ + public double getKey(int index) { + return key_.getDouble(index); + } + /** + * repeated double key = 10; + * @param index The index to set the value at. + * @param value The key to set. + * @return This builder for chaining. + */ + public Builder setKey( + int index, double value) { + ensureKeyIsMutable(); + key_.setDouble(index, value); + onChanged(); + return this; + } + /** + * repeated double key = 10; + * @param value The key to add. + * @return This builder for chaining. + */ + public Builder addKey(double value) { + ensureKeyIsMutable(); + key_.addDouble(value); + onChanged(); + return this; + } + /** + * repeated double key = 10; + * @param values The key to add. + * @return This builder for chaining. + */ + public Builder addAllKey( + java.lang.Iterable values) { + ensureKeyIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, key_); + onChanged(); + return this; + } + /** + * repeated double key = 10; + * @return This builder for chaining. + */ + public Builder clearKey() { + key_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.LongList value_ = emptyLongList(); + private void ensureValueIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + value_ = mutableCopy(value_); + bitField0_ |= 0x00000002; + } + } + /** + * repeated int64 value = 11; + * @return A list containing the value. + */ + public java.util.List + getValueList() { + return ((bitField0_ & 0x00000002) != 0) ? + java.util.Collections.unmodifiableList(value_) : value_; + } + /** + * repeated int64 value = 11; + * @return The count of value. + */ + public int getValueCount() { + return value_.size(); + } + /** + * repeated int64 value = 11; + * @param index The index of the element to return. + * @return The value at the given index. + */ + public long getValue(int index) { + return value_.getLong(index); + } + /** + * repeated int64 value = 11; + * @param index The index to set the value at. + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue( + int index, long value) { + ensureValueIsMutable(); + value_.setLong(index, value); + onChanged(); + return this; + } + /** + * repeated int64 value = 11; + * @param value The value to add. + * @return This builder for chaining. + */ + public Builder addValue(long value) { + ensureValueIsMutable(); + value_.addLong(value); + onChanged(); + return this; + } + /** + * repeated int64 value = 11; + * @param values The value to add. + * @return This builder for chaining. + */ + public Builder addAllValue( + java.lang.Iterable values) { + ensureValueIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, value_); + onChanged(); + return this; + } + /** + * repeated int64 value = 11; + * @return This builder for chaining. + */ + public Builder clearValue() { + value_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + private double observedValue_ ; + /** + * double observed_value = 12; + * @return The observedValue. + */ + @java.lang.Override + public double getObservedValue() { + return observedValue_; + } + /** + * double observed_value = 12; + * @param value The observedValue to set. + * @return This builder for chaining. + */ + public Builder setObservedValue(double value) { + + observedValue_ = value; + onChanged(); + return this; + } + /** + * double observed_value = 12; + * @return This builder for chaining. + */ + public Builder clearObservedValue() { + + observedValue_ = 0D; + onChanged(); + return this; + } + + private long observedCount_ ; + /** + * int64 observed_count = 13; + * @return The observedCount. + */ + @java.lang.Override + public long getObservedCount() { + return observedCount_; + } + /** + * int64 observed_count = 13; + * @param value The observedCount to set. + * @return This builder for chaining. + */ + public Builder setObservedCount(long value) { + + observedCount_ = value; + onChanged(); + return this; + } + /** + * int64 observed_count = 13; + * @return This builder for chaining. + */ + public Builder clearObservedCount() { + + observedCount_ = 0L; + 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:tribuo.core.CategoricalIDInfoProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.CategoricalIDInfoProto) + private static final org.tribuo.protos.core.CategoricalIDInfoProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.CategoricalIDInfoProto(); + } + + public static org.tribuo.protos.core.CategoricalIDInfoProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CategoricalIDInfoProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CategoricalIDInfoProto(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 org.tribuo.protos.core.CategoricalIDInfoProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/CategoricalIDInfoProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/CategoricalIDInfoProtoOrBuilder.java new file mode 100644 index 000000000..25a1e7a12 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/CategoricalIDInfoProtoOrBuilder.java @@ -0,0 +1,79 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface CategoricalIDInfoProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.CategoricalIDInfoProto) + com.google.protobuf.MessageOrBuilder { + + /** + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + * int32 count = 2; + * @return The count. + */ + int getCount(); + + /** + * int32 id = 3; + * @return The id. + */ + int getId(); + + /** + * repeated double key = 10; + * @return A list containing the key. + */ + java.util.List getKeyList(); + /** + * repeated double key = 10; + * @return The count of key. + */ + int getKeyCount(); + /** + * repeated double key = 10; + * @param index The index of the element to return. + * @return The key at the given index. + */ + double getKey(int index); + + /** + * repeated int64 value = 11; + * @return A list containing the value. + */ + java.util.List getValueList(); + /** + * repeated int64 value = 11; + * @return The count of value. + */ + int getValueCount(); + /** + * repeated int64 value = 11; + * @param index The index of the element to return. + * @return The value at the given index. + */ + long getValue(int index); + + /** + * double observed_value = 12; + * @return The observedValue. + */ + double getObservedValue(); + + /** + * int64 observed_count = 13; + * @return The observedCount. + */ + long getObservedCount(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/CategoricalInfoProto.java b/Core/src/main/java/org/tribuo/protos/core/CategoricalInfoProto.java new file mode 100644 index 000000000..51a0f6f22 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/CategoricalInfoProto.java @@ -0,0 +1,1115 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *CategoricalInfo proto
+ * 
+ * + * Protobuf type {@code tribuo.core.CategoricalInfoProto} + */ +public final class CategoricalInfoProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.CategoricalInfoProto) + CategoricalInfoProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use CategoricalInfoProto.newBuilder() to construct. + private CategoricalInfoProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private CategoricalInfoProto() { + name_ = ""; + key_ = emptyDoubleList(); + value_ = emptyLongList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new CategoricalInfoProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CategoricalInfoProto( + 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: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 16: { + + count_ = input.readInt32(); + break; + } + case 81: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + key_ = newDoubleList(); + mutable_bitField0_ |= 0x00000001; + } + key_.addDouble(input.readDouble()); + break; + } + case 82: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) { + key_ = newDoubleList(); + mutable_bitField0_ |= 0x00000001; + } + while (input.getBytesUntilLimit() > 0) { + key_.addDouble(input.readDouble()); + } + input.popLimit(limit); + break; + } + case 88: { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + value_ = newLongList(); + mutable_bitField0_ |= 0x00000002; + } + value_.addLong(input.readInt64()); + break; + } + case 90: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) { + value_ = newLongList(); + mutable_bitField0_ |= 0x00000002; + } + while (input.getBytesUntilLimit() > 0) { + value_.addLong(input.readInt64()); + } + input.popLimit(limit); + break; + } + case 97: { + + observedValue_ = input.readDouble(); + break; + } + case 104: { + + observedCount_ = input.readInt64(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + key_.makeImmutable(); // C + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + value_.makeImmutable(); // C + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_CategoricalInfoProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_CategoricalInfoProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.CategoricalInfoProto.class, org.tribuo.protos.core.CategoricalInfoProto.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * string name = 1; + * @return The name. + */ + @java.lang.Override + 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 = 1; + * @return The bytes for name. + */ + @java.lang.Override + 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; + } + } + + public static final int COUNT_FIELD_NUMBER = 2; + private int count_; + /** + * int32 count = 2; + * @return The count. + */ + @java.lang.Override + public int getCount() { + return count_; + } + + public static final int KEY_FIELD_NUMBER = 10; + private com.google.protobuf.Internal.DoubleList key_; + /** + * repeated double key = 10; + * @return A list containing the key. + */ + @java.lang.Override + public java.util.List + getKeyList() { + return key_; + } + /** + * repeated double key = 10; + * @return The count of key. + */ + public int getKeyCount() { + return key_.size(); + } + /** + * repeated double key = 10; + * @param index The index of the element to return. + * @return The key at the given index. + */ + public double getKey(int index) { + return key_.getDouble(index); + } + private int keyMemoizedSerializedSize = -1; + + public static final int VALUE_FIELD_NUMBER = 11; + private com.google.protobuf.Internal.LongList value_; + /** + * repeated int64 value = 11; + * @return A list containing the value. + */ + @java.lang.Override + public java.util.List + getValueList() { + return value_; + } + /** + * repeated int64 value = 11; + * @return The count of value. + */ + public int getValueCount() { + return value_.size(); + } + /** + * repeated int64 value = 11; + * @param index The index of the element to return. + * @return The value at the given index. + */ + public long getValue(int index) { + return value_.getLong(index); + } + private int valueMemoizedSerializedSize = -1; + + public static final int OBSERVED_VALUE_FIELD_NUMBER = 12; + private double observedValue_; + /** + * double observed_value = 12; + * @return The observedValue. + */ + @java.lang.Override + public double getObservedValue() { + return observedValue_; + } + + public static final int OBSERVED_COUNT_FIELD_NUMBER = 13; + private long observedCount_; + /** + * int64 observed_count = 13; + * @return The observedCount. + */ + @java.lang.Override + public long getObservedCount() { + return observedCount_; + } + + 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (count_ != 0) { + output.writeInt32(2, count_); + } + if (getKeyList().size() > 0) { + output.writeUInt32NoTag(82); + output.writeUInt32NoTag(keyMemoizedSerializedSize); + } + for (int i = 0; i < key_.size(); i++) { + output.writeDoubleNoTag(key_.getDouble(i)); + } + if (getValueList().size() > 0) { + output.writeUInt32NoTag(90); + output.writeUInt32NoTag(valueMemoizedSerializedSize); + } + for (int i = 0; i < value_.size(); i++) { + output.writeInt64NoTag(value_.getLong(i)); + } + if (java.lang.Double.doubleToRawLongBits(observedValue_) != 0) { + output.writeDouble(12, observedValue_); + } + if (observedCount_ != 0L) { + output.writeInt64(13, observedCount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (count_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, count_); + } + { + int dataSize = 0; + dataSize = 8 * getKeyList().size(); + size += dataSize; + if (!getKeyList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + keyMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < value_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeInt64SizeNoTag(value_.getLong(i)); + } + size += dataSize; + if (!getValueList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + valueMemoizedSerializedSize = dataSize; + } + if (java.lang.Double.doubleToRawLongBits(observedValue_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(12, observedValue_); + } + if (observedCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(13, observedCount_); + } + 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 org.tribuo.protos.core.CategoricalInfoProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.CategoricalInfoProto other = (org.tribuo.protos.core.CategoricalInfoProto) obj; + + if (!getName() + .equals(other.getName())) return false; + if (getCount() + != other.getCount()) return false; + if (!getKeyList() + .equals(other.getKeyList())) return false; + if (!getValueList() + .equals(other.getValueList())) return false; + if (java.lang.Double.doubleToLongBits(getObservedValue()) + != java.lang.Double.doubleToLongBits( + other.getObservedValue())) return false; + if (getObservedCount() + != other.getObservedCount()) 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) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + COUNT_FIELD_NUMBER; + hash = (53 * hash) + getCount(); + if (getKeyCount() > 0) { + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKeyList().hashCode(); + } + if (getValueCount() > 0) { + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValueList().hashCode(); + } + hash = (37 * hash) + OBSERVED_VALUE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getObservedValue())); + hash = (37 * hash) + OBSERVED_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getObservedCount()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.CategoricalInfoProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.CategoricalInfoProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.CategoricalInfoProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.CategoricalInfoProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.CategoricalInfoProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.CategoricalInfoProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.CategoricalInfoProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.CategoricalInfoProto 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 org.tribuo.protos.core.CategoricalInfoProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.CategoricalInfoProto 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 org.tribuo.protos.core.CategoricalInfoProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.CategoricalInfoProto 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(org.tribuo.protos.core.CategoricalInfoProto 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; + } + /** + *
+   *CategoricalInfo proto
+   * 
+ * + * Protobuf type {@code tribuo.core.CategoricalInfoProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.CategoricalInfoProto) + org.tribuo.protos.core.CategoricalInfoProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_CategoricalInfoProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_CategoricalInfoProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.CategoricalInfoProto.class, org.tribuo.protos.core.CategoricalInfoProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.CategoricalInfoProto.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(); + name_ = ""; + + count_ = 0; + + key_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000001); + value_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000002); + observedValue_ = 0D; + + observedCount_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_CategoricalInfoProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.CategoricalInfoProto getDefaultInstanceForType() { + return org.tribuo.protos.core.CategoricalInfoProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.CategoricalInfoProto build() { + org.tribuo.protos.core.CategoricalInfoProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.CategoricalInfoProto buildPartial() { + org.tribuo.protos.core.CategoricalInfoProto result = new org.tribuo.protos.core.CategoricalInfoProto(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.count_ = count_; + if (((bitField0_ & 0x00000001) != 0)) { + key_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.key_ = key_; + if (((bitField0_ & 0x00000002) != 0)) { + value_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.value_ = value_; + result.observedValue_ = observedValue_; + result.observedCount_ = observedCount_; + 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 org.tribuo.protos.core.CategoricalInfoProto) { + return mergeFrom((org.tribuo.protos.core.CategoricalInfoProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.CategoricalInfoProto other) { + if (other == org.tribuo.protos.core.CategoricalInfoProto.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getCount() != 0) { + setCount(other.getCount()); + } + if (!other.key_.isEmpty()) { + if (key_.isEmpty()) { + key_ = other.key_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureKeyIsMutable(); + key_.addAll(other.key_); + } + onChanged(); + } + if (!other.value_.isEmpty()) { + if (value_.isEmpty()) { + value_ = other.value_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureValueIsMutable(); + value_.addAll(other.value_); + } + onChanged(); + } + if (other.getObservedValue() != 0D) { + setObservedValue(other.getObservedValue()); + } + if (other.getObservedCount() != 0L) { + setObservedCount(other.getObservedCount()); + } + 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 { + org.tribuo.protos.core.CategoricalInfoProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.CategoricalInfoProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * string name = 1; + * @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 = 1; + * @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 = 1; + * @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 = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * string name = 1; + * @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; + } + + private int count_ ; + /** + * int32 count = 2; + * @return The count. + */ + @java.lang.Override + public int getCount() { + return count_; + } + /** + * int32 count = 2; + * @param value The count to set. + * @return This builder for chaining. + */ + public Builder setCount(int value) { + + count_ = value; + onChanged(); + return this; + } + /** + * int32 count = 2; + * @return This builder for chaining. + */ + public Builder clearCount() { + + count_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Internal.DoubleList key_ = emptyDoubleList(); + private void ensureKeyIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + key_ = mutableCopy(key_); + bitField0_ |= 0x00000001; + } + } + /** + * repeated double key = 10; + * @return A list containing the key. + */ + public java.util.List + getKeyList() { + return ((bitField0_ & 0x00000001) != 0) ? + java.util.Collections.unmodifiableList(key_) : key_; + } + /** + * repeated double key = 10; + * @return The count of key. + */ + public int getKeyCount() { + return key_.size(); + } + /** + * repeated double key = 10; + * @param index The index of the element to return. + * @return The key at the given index. + */ + public double getKey(int index) { + return key_.getDouble(index); + } + /** + * repeated double key = 10; + * @param index The index to set the value at. + * @param value The key to set. + * @return This builder for chaining. + */ + public Builder setKey( + int index, double value) { + ensureKeyIsMutable(); + key_.setDouble(index, value); + onChanged(); + return this; + } + /** + * repeated double key = 10; + * @param value The key to add. + * @return This builder for chaining. + */ + public Builder addKey(double value) { + ensureKeyIsMutable(); + key_.addDouble(value); + onChanged(); + return this; + } + /** + * repeated double key = 10; + * @param values The key to add. + * @return This builder for chaining. + */ + public Builder addAllKey( + java.lang.Iterable values) { + ensureKeyIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, key_); + onChanged(); + return this; + } + /** + * repeated double key = 10; + * @return This builder for chaining. + */ + public Builder clearKey() { + key_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.LongList value_ = emptyLongList(); + private void ensureValueIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + value_ = mutableCopy(value_); + bitField0_ |= 0x00000002; + } + } + /** + * repeated int64 value = 11; + * @return A list containing the value. + */ + public java.util.List + getValueList() { + return ((bitField0_ & 0x00000002) != 0) ? + java.util.Collections.unmodifiableList(value_) : value_; + } + /** + * repeated int64 value = 11; + * @return The count of value. + */ + public int getValueCount() { + return value_.size(); + } + /** + * repeated int64 value = 11; + * @param index The index of the element to return. + * @return The value at the given index. + */ + public long getValue(int index) { + return value_.getLong(index); + } + /** + * repeated int64 value = 11; + * @param index The index to set the value at. + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue( + int index, long value) { + ensureValueIsMutable(); + value_.setLong(index, value); + onChanged(); + return this; + } + /** + * repeated int64 value = 11; + * @param value The value to add. + * @return This builder for chaining. + */ + public Builder addValue(long value) { + ensureValueIsMutable(); + value_.addLong(value); + onChanged(); + return this; + } + /** + * repeated int64 value = 11; + * @param values The value to add. + * @return This builder for chaining. + */ + public Builder addAllValue( + java.lang.Iterable values) { + ensureValueIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, value_); + onChanged(); + return this; + } + /** + * repeated int64 value = 11; + * @return This builder for chaining. + */ + public Builder clearValue() { + value_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + private double observedValue_ ; + /** + * double observed_value = 12; + * @return The observedValue. + */ + @java.lang.Override + public double getObservedValue() { + return observedValue_; + } + /** + * double observed_value = 12; + * @param value The observedValue to set. + * @return This builder for chaining. + */ + public Builder setObservedValue(double value) { + + observedValue_ = value; + onChanged(); + return this; + } + /** + * double observed_value = 12; + * @return This builder for chaining. + */ + public Builder clearObservedValue() { + + observedValue_ = 0D; + onChanged(); + return this; + } + + private long observedCount_ ; + /** + * int64 observed_count = 13; + * @return The observedCount. + */ + @java.lang.Override + public long getObservedCount() { + return observedCount_; + } + /** + * int64 observed_count = 13; + * @param value The observedCount to set. + * @return This builder for chaining. + */ + public Builder setObservedCount(long value) { + + observedCount_ = value; + onChanged(); + return this; + } + /** + * int64 observed_count = 13; + * @return This builder for chaining. + */ + public Builder clearObservedCount() { + + observedCount_ = 0L; + 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:tribuo.core.CategoricalInfoProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.CategoricalInfoProto) + private static final org.tribuo.protos.core.CategoricalInfoProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.CategoricalInfoProto(); + } + + public static org.tribuo.protos.core.CategoricalInfoProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CategoricalInfoProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CategoricalInfoProto(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 org.tribuo.protos.core.CategoricalInfoProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/CategoricalInfoProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/CategoricalInfoProtoOrBuilder.java new file mode 100644 index 000000000..6e82a72ff --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/CategoricalInfoProtoOrBuilder.java @@ -0,0 +1,73 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface CategoricalInfoProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.CategoricalInfoProto) + com.google.protobuf.MessageOrBuilder { + + /** + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + * int32 count = 2; + * @return The count. + */ + int getCount(); + + /** + * repeated double key = 10; + * @return A list containing the key. + */ + java.util.List getKeyList(); + /** + * repeated double key = 10; + * @return The count of key. + */ + int getKeyCount(); + /** + * repeated double key = 10; + * @param index The index of the element to return. + * @return The key at the given index. + */ + double getKey(int index); + + /** + * repeated int64 value = 11; + * @return A list containing the value. + */ + java.util.List getValueList(); + /** + * repeated int64 value = 11; + * @return The count of value. + */ + int getValueCount(); + /** + * repeated int64 value = 11; + * @param index The index of the element to return. + * @return The value at the given index. + */ + long getValue(int index); + + /** + * double observed_value = 12; + * @return The observedValue. + */ + double getObservedValue(); + + /** + * int64 observed_count = 13; + * @return The observedCount. + */ + long getObservedCount(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/DatasetProto.java b/Core/src/main/java/org/tribuo/protos/core/DatasetProto.java new file mode 100644 index 000000000..294b42e69 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/DatasetProto.java @@ -0,0 +1,1734 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Dataset proto
+ * 
+ * + * Protobuf type {@code tribuo.core.DatasetProto} + */ +public final class DatasetProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.DatasetProto) + DatasetProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use DatasetProto.newBuilder() to construct. + private DatasetProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private DatasetProto() { + className_ = ""; + examples_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new DatasetProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private DatasetProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder subBuilder = null; + if (provenance_ != null) { + subBuilder = provenance_.toBuilder(); + } + provenance_ = input.readMessage(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(provenance_); + provenance_ = subBuilder.buildPartial(); + } + + break; + } + case 34: { + org.tribuo.protos.core.FeatureDomainProto.Builder subBuilder = null; + if (featureDomain_ != null) { + subBuilder = featureDomain_.toBuilder(); + } + featureDomain_ = input.readMessage(org.tribuo.protos.core.FeatureDomainProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(featureDomain_); + featureDomain_ = subBuilder.buildPartial(); + } + + break; + } + case 42: { + org.tribuo.protos.core.OutputDomainProto.Builder subBuilder = null; + if (outputDomain_ != null) { + subBuilder = outputDomain_.toBuilder(); + } + outputDomain_ = input.readMessage(org.tribuo.protos.core.OutputDomainProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(outputDomain_); + outputDomain_ = subBuilder.buildPartial(); + } + + break; + } + case 50: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + examples_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + examples_.add( + input.readMessage(org.tribuo.protos.core.ExampleProto.parser(), extensionRegistry)); + break; + } + case 58: { + com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto.Builder subBuilder = null; + if (transformProvenance_ != null) { + subBuilder = transformProvenance_.toBuilder(); + } + transformProvenance_ = input.readMessage(com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(transformProvenance_); + transformProvenance_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + examples_ = java.util.Collections.unmodifiableList(examples_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_DatasetProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_DatasetProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.DatasetProto.class, org.tribuo.protos.core.DatasetProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PROVENANCE_FIELD_NUMBER = 3; + private com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto provenance_; + /** + * .olcut.RootProvenanceProto provenance = 3; + * @return Whether the provenance field is set. + */ + @java.lang.Override + public boolean hasProvenance() { + return provenance_ != null; + } + /** + * .olcut.RootProvenanceProto provenance = 3; + * @return The provenance. + */ + @java.lang.Override + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getProvenance() { + return provenance_ == null ? com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : provenance_; + } + /** + * .olcut.RootProvenanceProto provenance = 3; + */ + @java.lang.Override + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getProvenanceOrBuilder() { + return getProvenance(); + } + + public static final int FEATURE_DOMAIN_FIELD_NUMBER = 4; + private org.tribuo.protos.core.FeatureDomainProto featureDomain_; + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + * @return Whether the featureDomain field is set. + */ + @java.lang.Override + public boolean hasFeatureDomain() { + return featureDomain_ != null; + } + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + * @return The featureDomain. + */ + @java.lang.Override + public org.tribuo.protos.core.FeatureDomainProto getFeatureDomain() { + return featureDomain_ == null ? org.tribuo.protos.core.FeatureDomainProto.getDefaultInstance() : featureDomain_; + } + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + */ + @java.lang.Override + public org.tribuo.protos.core.FeatureDomainProtoOrBuilder getFeatureDomainOrBuilder() { + return getFeatureDomain(); + } + + public static final int OUTPUT_DOMAIN_FIELD_NUMBER = 5; + private org.tribuo.protos.core.OutputDomainProto outputDomain_; + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + * @return Whether the outputDomain field is set. + */ + @java.lang.Override + public boolean hasOutputDomain() { + return outputDomain_ != null; + } + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + * @return The outputDomain. + */ + @java.lang.Override + public org.tribuo.protos.core.OutputDomainProto getOutputDomain() { + return outputDomain_ == null ? org.tribuo.protos.core.OutputDomainProto.getDefaultInstance() : outputDomain_; + } + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + */ + @java.lang.Override + public org.tribuo.protos.core.OutputDomainProtoOrBuilder getOutputDomainOrBuilder() { + return getOutputDomain(); + } + + public static final int EXAMPLES_FIELD_NUMBER = 6; + private java.util.List examples_; + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + @java.lang.Override + public java.util.List getExamplesList() { + return examples_; + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + @java.lang.Override + public java.util.List + getExamplesOrBuilderList() { + return examples_; + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + @java.lang.Override + public int getExamplesCount() { + return examples_.size(); + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + @java.lang.Override + public org.tribuo.protos.core.ExampleProto getExamples(int index) { + return examples_.get(index); + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + @java.lang.Override + public org.tribuo.protos.core.ExampleProtoOrBuilder getExamplesOrBuilder( + int index) { + return examples_.get(index); + } + + public static final int TRANSFORM_PROVENANCE_FIELD_NUMBER = 7; + private com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto transformProvenance_; + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + * @return Whether the transformProvenance field is set. + */ + @java.lang.Override + public boolean hasTransformProvenance() { + return transformProvenance_ != null; + } + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + * @return The transformProvenance. + */ + @java.lang.Override + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto getTransformProvenance() { + return transformProvenance_ == null ? com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto.getDefaultInstance() : transformProvenance_; + } + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + */ + @java.lang.Override + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProtoOrBuilder getTransformProvenanceOrBuilder() { + return getTransformProvenance(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (provenance_ != null) { + output.writeMessage(3, getProvenance()); + } + if (featureDomain_ != null) { + output.writeMessage(4, getFeatureDomain()); + } + if (outputDomain_ != null) { + output.writeMessage(5, getOutputDomain()); + } + for (int i = 0; i < examples_.size(); i++) { + output.writeMessage(6, examples_.get(i)); + } + if (transformProvenance_ != null) { + output.writeMessage(7, getTransformProvenance()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (provenance_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getProvenance()); + } + if (featureDomain_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getFeatureDomain()); + } + if (outputDomain_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, getOutputDomain()); + } + for (int i = 0; i < examples_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, examples_.get(i)); + } + if (transformProvenance_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, getTransformProvenance()); + } + 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 org.tribuo.protos.core.DatasetProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.DatasetProto other = (org.tribuo.protos.core.DatasetProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasProvenance() != other.hasProvenance()) return false; + if (hasProvenance()) { + if (!getProvenance() + .equals(other.getProvenance())) return false; + } + if (hasFeatureDomain() != other.hasFeatureDomain()) return false; + if (hasFeatureDomain()) { + if (!getFeatureDomain() + .equals(other.getFeatureDomain())) return false; + } + if (hasOutputDomain() != other.hasOutputDomain()) return false; + if (hasOutputDomain()) { + if (!getOutputDomain() + .equals(other.getOutputDomain())) return false; + } + if (!getExamplesList() + .equals(other.getExamplesList())) return false; + if (hasTransformProvenance() != other.hasTransformProvenance()) return false; + if (hasTransformProvenance()) { + if (!getTransformProvenance() + .equals(other.getTransformProvenance())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasProvenance()) { + hash = (37 * hash) + PROVENANCE_FIELD_NUMBER; + hash = (53 * hash) + getProvenance().hashCode(); + } + if (hasFeatureDomain()) { + hash = (37 * hash) + FEATURE_DOMAIN_FIELD_NUMBER; + hash = (53 * hash) + getFeatureDomain().hashCode(); + } + if (hasOutputDomain()) { + hash = (37 * hash) + OUTPUT_DOMAIN_FIELD_NUMBER; + hash = (53 * hash) + getOutputDomain().hashCode(); + } + if (getExamplesCount() > 0) { + hash = (37 * hash) + EXAMPLES_FIELD_NUMBER; + hash = (53 * hash) + getExamplesList().hashCode(); + } + if (hasTransformProvenance()) { + hash = (37 * hash) + TRANSFORM_PROVENANCE_FIELD_NUMBER; + hash = (53 * hash) + getTransformProvenance().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.DatasetProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.DatasetProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.DatasetProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.DatasetProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.DatasetProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.DatasetProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.DatasetProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.DatasetProto 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 org.tribuo.protos.core.DatasetProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.DatasetProto 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 org.tribuo.protos.core.DatasetProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.DatasetProto 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(org.tribuo.protos.core.DatasetProto 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; + } + /** + *
+   *Dataset proto
+   * 
+ * + * Protobuf type {@code tribuo.core.DatasetProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.DatasetProto) + org.tribuo.protos.core.DatasetProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_DatasetProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_DatasetProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.DatasetProto.class, org.tribuo.protos.core.DatasetProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.DatasetProto.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getExamplesFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + version_ = 0; + + className_ = ""; + + if (provenanceBuilder_ == null) { + provenance_ = null; + } else { + provenance_ = null; + provenanceBuilder_ = null; + } + if (featureDomainBuilder_ == null) { + featureDomain_ = null; + } else { + featureDomain_ = null; + featureDomainBuilder_ = null; + } + if (outputDomainBuilder_ == null) { + outputDomain_ = null; + } else { + outputDomain_ = null; + outputDomainBuilder_ = null; + } + if (examplesBuilder_ == null) { + examples_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + examplesBuilder_.clear(); + } + if (transformProvenanceBuilder_ == null) { + transformProvenance_ = null; + } else { + transformProvenance_ = null; + transformProvenanceBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_DatasetProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.DatasetProto getDefaultInstanceForType() { + return org.tribuo.protos.core.DatasetProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.DatasetProto build() { + org.tribuo.protos.core.DatasetProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.DatasetProto buildPartial() { + org.tribuo.protos.core.DatasetProto result = new org.tribuo.protos.core.DatasetProto(this); + int from_bitField0_ = bitField0_; + result.version_ = version_; + result.className_ = className_; + if (provenanceBuilder_ == null) { + result.provenance_ = provenance_; + } else { + result.provenance_ = provenanceBuilder_.build(); + } + if (featureDomainBuilder_ == null) { + result.featureDomain_ = featureDomain_; + } else { + result.featureDomain_ = featureDomainBuilder_.build(); + } + if (outputDomainBuilder_ == null) { + result.outputDomain_ = outputDomain_; + } else { + result.outputDomain_ = outputDomainBuilder_.build(); + } + if (examplesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + examples_ = java.util.Collections.unmodifiableList(examples_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.examples_ = examples_; + } else { + result.examples_ = examplesBuilder_.build(); + } + if (transformProvenanceBuilder_ == null) { + result.transformProvenance_ = transformProvenance_; + } else { + result.transformProvenance_ = transformProvenanceBuilder_.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 org.tribuo.protos.core.DatasetProto) { + return mergeFrom((org.tribuo.protos.core.DatasetProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.DatasetProto other) { + if (other == org.tribuo.protos.core.DatasetProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasProvenance()) { + mergeProvenance(other.getProvenance()); + } + if (other.hasFeatureDomain()) { + mergeFeatureDomain(other.getFeatureDomain()); + } + if (other.hasOutputDomain()) { + mergeOutputDomain(other.getOutputDomain()); + } + if (examplesBuilder_ == null) { + if (!other.examples_.isEmpty()) { + if (examples_.isEmpty()) { + examples_ = other.examples_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureExamplesIsMutable(); + examples_.addAll(other.examples_); + } + onChanged(); + } + } else { + if (!other.examples_.isEmpty()) { + if (examplesBuilder_.isEmpty()) { + examplesBuilder_.dispose(); + examplesBuilder_ = null; + examples_ = other.examples_; + bitField0_ = (bitField0_ & ~0x00000001); + examplesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getExamplesFieldBuilder() : null; + } else { + examplesBuilder_.addAllMessages(other.examples_); + } + } + } + if (other.hasTransformProvenance()) { + mergeTransformProvenance(other.getTransformProvenance()); + } + 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 { + org.tribuo.protos.core.DatasetProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.DatasetProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto provenance_; + private com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder> provenanceBuilder_; + /** + * .olcut.RootProvenanceProto provenance = 3; + * @return Whether the provenance field is set. + */ + public boolean hasProvenance() { + return provenanceBuilder_ != null || provenance_ != null; + } + /** + * .olcut.RootProvenanceProto provenance = 3; + * @return The provenance. + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getProvenance() { + if (provenanceBuilder_ == null) { + return provenance_ == null ? com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : provenance_; + } else { + return provenanceBuilder_.getMessage(); + } + } + /** + * .olcut.RootProvenanceProto provenance = 3; + */ + public Builder setProvenance(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto value) { + if (provenanceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + provenance_ = value; + onChanged(); + } else { + provenanceBuilder_.setMessage(value); + } + + return this; + } + /** + * .olcut.RootProvenanceProto provenance = 3; + */ + public Builder setProvenance( + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder builderForValue) { + if (provenanceBuilder_ == null) { + provenance_ = builderForValue.build(); + onChanged(); + } else { + provenanceBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .olcut.RootProvenanceProto provenance = 3; + */ + public Builder mergeProvenance(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto value) { + if (provenanceBuilder_ == null) { + if (provenance_ != null) { + provenance_ = + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.newBuilder(provenance_).mergeFrom(value).buildPartial(); + } else { + provenance_ = value; + } + onChanged(); + } else { + provenanceBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .olcut.RootProvenanceProto provenance = 3; + */ + public Builder clearProvenance() { + if (provenanceBuilder_ == null) { + provenance_ = null; + onChanged(); + } else { + provenance_ = null; + provenanceBuilder_ = null; + } + + return this; + } + /** + * .olcut.RootProvenanceProto provenance = 3; + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder getProvenanceBuilder() { + + onChanged(); + return getProvenanceFieldBuilder().getBuilder(); + } + /** + * .olcut.RootProvenanceProto provenance = 3; + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getProvenanceOrBuilder() { + if (provenanceBuilder_ != null) { + return provenanceBuilder_.getMessageOrBuilder(); + } else { + return provenance_ == null ? + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : provenance_; + } + } + /** + * .olcut.RootProvenanceProto provenance = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder> + getProvenanceFieldBuilder() { + if (provenanceBuilder_ == null) { + provenanceBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder>( + getProvenance(), + getParentForChildren(), + isClean()); + provenance_ = null; + } + return provenanceBuilder_; + } + + private org.tribuo.protos.core.FeatureDomainProto featureDomain_; + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.FeatureDomainProto, org.tribuo.protos.core.FeatureDomainProto.Builder, org.tribuo.protos.core.FeatureDomainProtoOrBuilder> featureDomainBuilder_; + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + * @return Whether the featureDomain field is set. + */ + public boolean hasFeatureDomain() { + return featureDomainBuilder_ != null || featureDomain_ != null; + } + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + * @return The featureDomain. + */ + public org.tribuo.protos.core.FeatureDomainProto getFeatureDomain() { + if (featureDomainBuilder_ == null) { + return featureDomain_ == null ? org.tribuo.protos.core.FeatureDomainProto.getDefaultInstance() : featureDomain_; + } else { + return featureDomainBuilder_.getMessage(); + } + } + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + */ + public Builder setFeatureDomain(org.tribuo.protos.core.FeatureDomainProto value) { + if (featureDomainBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + featureDomain_ = value; + onChanged(); + } else { + featureDomainBuilder_.setMessage(value); + } + + return this; + } + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + */ + public Builder setFeatureDomain( + org.tribuo.protos.core.FeatureDomainProto.Builder builderForValue) { + if (featureDomainBuilder_ == null) { + featureDomain_ = builderForValue.build(); + onChanged(); + } else { + featureDomainBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + */ + public Builder mergeFeatureDomain(org.tribuo.protos.core.FeatureDomainProto value) { + if (featureDomainBuilder_ == null) { + if (featureDomain_ != null) { + featureDomain_ = + org.tribuo.protos.core.FeatureDomainProto.newBuilder(featureDomain_).mergeFrom(value).buildPartial(); + } else { + featureDomain_ = value; + } + onChanged(); + } else { + featureDomainBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + */ + public Builder clearFeatureDomain() { + if (featureDomainBuilder_ == null) { + featureDomain_ = null; + onChanged(); + } else { + featureDomain_ = null; + featureDomainBuilder_ = null; + } + + return this; + } + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + */ + public org.tribuo.protos.core.FeatureDomainProto.Builder getFeatureDomainBuilder() { + + onChanged(); + return getFeatureDomainFieldBuilder().getBuilder(); + } + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + */ + public org.tribuo.protos.core.FeatureDomainProtoOrBuilder getFeatureDomainOrBuilder() { + if (featureDomainBuilder_ != null) { + return featureDomainBuilder_.getMessageOrBuilder(); + } else { + return featureDomain_ == null ? + org.tribuo.protos.core.FeatureDomainProto.getDefaultInstance() : featureDomain_; + } + } + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.FeatureDomainProto, org.tribuo.protos.core.FeatureDomainProto.Builder, org.tribuo.protos.core.FeatureDomainProtoOrBuilder> + getFeatureDomainFieldBuilder() { + if (featureDomainBuilder_ == null) { + featureDomainBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.FeatureDomainProto, org.tribuo.protos.core.FeatureDomainProto.Builder, org.tribuo.protos.core.FeatureDomainProtoOrBuilder>( + getFeatureDomain(), + getParentForChildren(), + isClean()); + featureDomain_ = null; + } + return featureDomainBuilder_; + } + + private org.tribuo.protos.core.OutputDomainProto outputDomain_; + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputDomainProto, org.tribuo.protos.core.OutputDomainProto.Builder, org.tribuo.protos.core.OutputDomainProtoOrBuilder> outputDomainBuilder_; + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + * @return Whether the outputDomain field is set. + */ + public boolean hasOutputDomain() { + return outputDomainBuilder_ != null || outputDomain_ != null; + } + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + * @return The outputDomain. + */ + public org.tribuo.protos.core.OutputDomainProto getOutputDomain() { + if (outputDomainBuilder_ == null) { + return outputDomain_ == null ? org.tribuo.protos.core.OutputDomainProto.getDefaultInstance() : outputDomain_; + } else { + return outputDomainBuilder_.getMessage(); + } + } + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + */ + public Builder setOutputDomain(org.tribuo.protos.core.OutputDomainProto value) { + if (outputDomainBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + outputDomain_ = value; + onChanged(); + } else { + outputDomainBuilder_.setMessage(value); + } + + return this; + } + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + */ + public Builder setOutputDomain( + org.tribuo.protos.core.OutputDomainProto.Builder builderForValue) { + if (outputDomainBuilder_ == null) { + outputDomain_ = builderForValue.build(); + onChanged(); + } else { + outputDomainBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + */ + public Builder mergeOutputDomain(org.tribuo.protos.core.OutputDomainProto value) { + if (outputDomainBuilder_ == null) { + if (outputDomain_ != null) { + outputDomain_ = + org.tribuo.protos.core.OutputDomainProto.newBuilder(outputDomain_).mergeFrom(value).buildPartial(); + } else { + outputDomain_ = value; + } + onChanged(); + } else { + outputDomainBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + */ + public Builder clearOutputDomain() { + if (outputDomainBuilder_ == null) { + outputDomain_ = null; + onChanged(); + } else { + outputDomain_ = null; + outputDomainBuilder_ = null; + } + + return this; + } + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + */ + public org.tribuo.protos.core.OutputDomainProto.Builder getOutputDomainBuilder() { + + onChanged(); + return getOutputDomainFieldBuilder().getBuilder(); + } + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + */ + public org.tribuo.protos.core.OutputDomainProtoOrBuilder getOutputDomainOrBuilder() { + if (outputDomainBuilder_ != null) { + return outputDomainBuilder_.getMessageOrBuilder(); + } else { + return outputDomain_ == null ? + org.tribuo.protos.core.OutputDomainProto.getDefaultInstance() : outputDomain_; + } + } + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputDomainProto, org.tribuo.protos.core.OutputDomainProto.Builder, org.tribuo.protos.core.OutputDomainProtoOrBuilder> + getOutputDomainFieldBuilder() { + if (outputDomainBuilder_ == null) { + outputDomainBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputDomainProto, org.tribuo.protos.core.OutputDomainProto.Builder, org.tribuo.protos.core.OutputDomainProtoOrBuilder>( + getOutputDomain(), + getParentForChildren(), + isClean()); + outputDomain_ = null; + } + return outputDomainBuilder_; + } + + private java.util.List examples_ = + java.util.Collections.emptyList(); + private void ensureExamplesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + examples_ = new java.util.ArrayList(examples_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.ExampleProto, org.tribuo.protos.core.ExampleProto.Builder, org.tribuo.protos.core.ExampleProtoOrBuilder> examplesBuilder_; + + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public java.util.List getExamplesList() { + if (examplesBuilder_ == null) { + return java.util.Collections.unmodifiableList(examples_); + } else { + return examplesBuilder_.getMessageList(); + } + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public int getExamplesCount() { + if (examplesBuilder_ == null) { + return examples_.size(); + } else { + return examplesBuilder_.getCount(); + } + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public org.tribuo.protos.core.ExampleProto getExamples(int index) { + if (examplesBuilder_ == null) { + return examples_.get(index); + } else { + return examplesBuilder_.getMessage(index); + } + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public Builder setExamples( + int index, org.tribuo.protos.core.ExampleProto value) { + if (examplesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExamplesIsMutable(); + examples_.set(index, value); + onChanged(); + } else { + examplesBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public Builder setExamples( + int index, org.tribuo.protos.core.ExampleProto.Builder builderForValue) { + if (examplesBuilder_ == null) { + ensureExamplesIsMutable(); + examples_.set(index, builderForValue.build()); + onChanged(); + } else { + examplesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public Builder addExamples(org.tribuo.protos.core.ExampleProto value) { + if (examplesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExamplesIsMutable(); + examples_.add(value); + onChanged(); + } else { + examplesBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public Builder addExamples( + int index, org.tribuo.protos.core.ExampleProto value) { + if (examplesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExamplesIsMutable(); + examples_.add(index, value); + onChanged(); + } else { + examplesBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public Builder addExamples( + org.tribuo.protos.core.ExampleProto.Builder builderForValue) { + if (examplesBuilder_ == null) { + ensureExamplesIsMutable(); + examples_.add(builderForValue.build()); + onChanged(); + } else { + examplesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public Builder addExamples( + int index, org.tribuo.protos.core.ExampleProto.Builder builderForValue) { + if (examplesBuilder_ == null) { + ensureExamplesIsMutable(); + examples_.add(index, builderForValue.build()); + onChanged(); + } else { + examplesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public Builder addAllExamples( + java.lang.Iterable values) { + if (examplesBuilder_ == null) { + ensureExamplesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, examples_); + onChanged(); + } else { + examplesBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public Builder clearExamples() { + if (examplesBuilder_ == null) { + examples_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + examplesBuilder_.clear(); + } + return this; + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public Builder removeExamples(int index) { + if (examplesBuilder_ == null) { + ensureExamplesIsMutable(); + examples_.remove(index); + onChanged(); + } else { + examplesBuilder_.remove(index); + } + return this; + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public org.tribuo.protos.core.ExampleProto.Builder getExamplesBuilder( + int index) { + return getExamplesFieldBuilder().getBuilder(index); + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public org.tribuo.protos.core.ExampleProtoOrBuilder getExamplesOrBuilder( + int index) { + if (examplesBuilder_ == null) { + return examples_.get(index); } else { + return examplesBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public java.util.List + getExamplesOrBuilderList() { + if (examplesBuilder_ != null) { + return examplesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(examples_); + } + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public org.tribuo.protos.core.ExampleProto.Builder addExamplesBuilder() { + return getExamplesFieldBuilder().addBuilder( + org.tribuo.protos.core.ExampleProto.getDefaultInstance()); + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public org.tribuo.protos.core.ExampleProto.Builder addExamplesBuilder( + int index) { + return getExamplesFieldBuilder().addBuilder( + index, org.tribuo.protos.core.ExampleProto.getDefaultInstance()); + } + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + public java.util.List + getExamplesBuilderList() { + return getExamplesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.ExampleProto, org.tribuo.protos.core.ExampleProto.Builder, org.tribuo.protos.core.ExampleProtoOrBuilder> + getExamplesFieldBuilder() { + if (examplesBuilder_ == null) { + examplesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.ExampleProto, org.tribuo.protos.core.ExampleProto.Builder, org.tribuo.protos.core.ExampleProtoOrBuilder>( + examples_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + examples_ = null; + } + return examplesBuilder_; + } + + private com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto transformProvenance_; + private com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProtoOrBuilder> transformProvenanceBuilder_; + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + * @return Whether the transformProvenance field is set. + */ + public boolean hasTransformProvenance() { + return transformProvenanceBuilder_ != null || transformProvenance_ != null; + } + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + * @return The transformProvenance. + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto getTransformProvenance() { + if (transformProvenanceBuilder_ == null) { + return transformProvenance_ == null ? com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto.getDefaultInstance() : transformProvenance_; + } else { + return transformProvenanceBuilder_.getMessage(); + } + } + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + */ + public Builder setTransformProvenance(com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto value) { + if (transformProvenanceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + transformProvenance_ = value; + onChanged(); + } else { + transformProvenanceBuilder_.setMessage(value); + } + + return this; + } + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + */ + public Builder setTransformProvenance( + com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto.Builder builderForValue) { + if (transformProvenanceBuilder_ == null) { + transformProvenance_ = builderForValue.build(); + onChanged(); + } else { + transformProvenanceBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + */ + public Builder mergeTransformProvenance(com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto value) { + if (transformProvenanceBuilder_ == null) { + if (transformProvenance_ != null) { + transformProvenance_ = + com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto.newBuilder(transformProvenance_).mergeFrom(value).buildPartial(); + } else { + transformProvenance_ = value; + } + onChanged(); + } else { + transformProvenanceBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + */ + public Builder clearTransformProvenance() { + if (transformProvenanceBuilder_ == null) { + transformProvenance_ = null; + onChanged(); + } else { + transformProvenance_ = null; + transformProvenanceBuilder_ = null; + } + + return this; + } + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto.Builder getTransformProvenanceBuilder() { + + onChanged(); + return getTransformProvenanceFieldBuilder().getBuilder(); + } + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProtoOrBuilder getTransformProvenanceOrBuilder() { + if (transformProvenanceBuilder_ != null) { + return transformProvenanceBuilder_.getMessageOrBuilder(); + } else { + return transformProvenance_ == null ? + com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto.getDefaultInstance() : transformProvenance_; + } + } + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProtoOrBuilder> + getTransformProvenanceFieldBuilder() { + if (transformProvenanceBuilder_ == null) { + transformProvenanceBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProtoOrBuilder>( + getTransformProvenance(), + getParentForChildren(), + isClean()); + transformProvenance_ = null; + } + return transformProvenanceBuilder_; + } + @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:tribuo.core.DatasetProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.DatasetProto) + private static final org.tribuo.protos.core.DatasetProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.DatasetProto(); + } + + public static org.tribuo.protos.core.DatasetProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DatasetProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DatasetProto(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 org.tribuo.protos.core.DatasetProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/DatasetProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/DatasetProtoOrBuilder.java new file mode 100644 index 000000000..474e9bc33 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/DatasetProtoOrBuilder.java @@ -0,0 +1,111 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface DatasetProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.DatasetProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .olcut.RootProvenanceProto provenance = 3; + * @return Whether the provenance field is set. + */ + boolean hasProvenance(); + /** + * .olcut.RootProvenanceProto provenance = 3; + * @return The provenance. + */ + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getProvenance(); + /** + * .olcut.RootProvenanceProto provenance = 3; + */ + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getProvenanceOrBuilder(); + + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + * @return Whether the featureDomain field is set. + */ + boolean hasFeatureDomain(); + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + * @return The featureDomain. + */ + org.tribuo.protos.core.FeatureDomainProto getFeatureDomain(); + /** + * .tribuo.core.FeatureDomainProto feature_domain = 4; + */ + org.tribuo.protos.core.FeatureDomainProtoOrBuilder getFeatureDomainOrBuilder(); + + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + * @return Whether the outputDomain field is set. + */ + boolean hasOutputDomain(); + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + * @return The outputDomain. + */ + org.tribuo.protos.core.OutputDomainProto getOutputDomain(); + /** + * .tribuo.core.OutputDomainProto output_domain = 5; + */ + org.tribuo.protos.core.OutputDomainProtoOrBuilder getOutputDomainOrBuilder(); + + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + java.util.List + getExamplesList(); + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + org.tribuo.protos.core.ExampleProto getExamples(int index); + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + int getExamplesCount(); + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + java.util.List + getExamplesOrBuilderList(); + /** + * repeated .tribuo.core.ExampleProto examples = 6; + */ + org.tribuo.protos.core.ExampleProtoOrBuilder getExamplesOrBuilder( + int index); + + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + * @return Whether the transformProvenance field is set. + */ + boolean hasTransformProvenance(); + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + * @return The transformProvenance. + */ + com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProto getTransformProvenance(); + /** + * .olcut.ListProvenanceProto transform_provenance = 7; + */ + com.oracle.labs.mlrg.olcut.config.protobuf.protos.ListProvenanceProtoOrBuilder getTransformProvenanceOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/EnsembleCombinerProto.java b/Core/src/main/java/org/tribuo/protos/core/EnsembleCombinerProto.java new file mode 100644 index 000000000..1ce7060cd --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/EnsembleCombinerProto.java @@ -0,0 +1,819 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Combiner redirection proto
+ * 
+ * + * Protobuf type {@code tribuo.core.EnsembleCombinerProto} + */ +public final class EnsembleCombinerProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.EnsembleCombinerProto) + EnsembleCombinerProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use EnsembleCombinerProto.newBuilder() to construct. + private EnsembleCombinerProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private EnsembleCombinerProto() { + className_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new EnsembleCombinerProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private EnsembleCombinerProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + com.google.protobuf.Any.Builder subBuilder = null; + if (serializedData_ != null) { + subBuilder = serializedData_.toBuilder(); + } + serializedData_ = input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(serializedData_); + serializedData_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_EnsembleCombinerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_EnsembleCombinerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.EnsembleCombinerProto.class, org.tribuo.protos.core.EnsembleCombinerProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERIALIZED_DATA_FIELD_NUMBER = 3; + private com.google.protobuf.Any serializedData_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + @java.lang.Override + public boolean hasSerializedData() { + return serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + @java.lang.Override + public com.google.protobuf.Any getSerializedData() { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + @java.lang.Override + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + return getSerializedData(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (serializedData_ != null) { + output.writeMessage(3, getSerializedData()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (serializedData_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getSerializedData()); + } + 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 org.tribuo.protos.core.EnsembleCombinerProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.EnsembleCombinerProto other = (org.tribuo.protos.core.EnsembleCombinerProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasSerializedData() != other.hasSerializedData()) return false; + if (hasSerializedData()) { + if (!getSerializedData() + .equals(other.getSerializedData())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasSerializedData()) { + hash = (37 * hash) + SERIALIZED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getSerializedData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.EnsembleCombinerProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.EnsembleCombinerProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.EnsembleCombinerProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.EnsembleCombinerProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.EnsembleCombinerProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.EnsembleCombinerProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.EnsembleCombinerProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.EnsembleCombinerProto 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 org.tribuo.protos.core.EnsembleCombinerProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.EnsembleCombinerProto 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 org.tribuo.protos.core.EnsembleCombinerProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.EnsembleCombinerProto 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(org.tribuo.protos.core.EnsembleCombinerProto 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; + } + /** + *
+   *Combiner redirection proto
+   * 
+ * + * Protobuf type {@code tribuo.core.EnsembleCombinerProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.EnsembleCombinerProto) + org.tribuo.protos.core.EnsembleCombinerProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_EnsembleCombinerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_EnsembleCombinerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.EnsembleCombinerProto.class, org.tribuo.protos.core.EnsembleCombinerProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.EnsembleCombinerProto.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(); + version_ = 0; + + className_ = ""; + + if (serializedDataBuilder_ == null) { + serializedData_ = null; + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_EnsembleCombinerProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.EnsembleCombinerProto getDefaultInstanceForType() { + return org.tribuo.protos.core.EnsembleCombinerProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.EnsembleCombinerProto build() { + org.tribuo.protos.core.EnsembleCombinerProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.EnsembleCombinerProto buildPartial() { + org.tribuo.protos.core.EnsembleCombinerProto result = new org.tribuo.protos.core.EnsembleCombinerProto(this); + result.version_ = version_; + result.className_ = className_; + if (serializedDataBuilder_ == null) { + result.serializedData_ = serializedData_; + } else { + result.serializedData_ = serializedDataBuilder_.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 org.tribuo.protos.core.EnsembleCombinerProto) { + return mergeFrom((org.tribuo.protos.core.EnsembleCombinerProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.EnsembleCombinerProto other) { + if (other == org.tribuo.protos.core.EnsembleCombinerProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasSerializedData()) { + mergeSerializedData(other.getSerializedData()); + } + 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 { + org.tribuo.protos.core.EnsembleCombinerProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.EnsembleCombinerProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Any serializedData_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> serializedDataBuilder_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + public boolean hasSerializedData() { + return serializedDataBuilder_ != null || serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + public com.google.protobuf.Any getSerializedData() { + if (serializedDataBuilder_ == null) { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } else { + return serializedDataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + serializedData_ = value; + onChanged(); + } else { + serializedDataBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData( + com.google.protobuf.Any.Builder builderForValue) { + if (serializedDataBuilder_ == null) { + serializedData_ = builderForValue.build(); + onChanged(); + } else { + serializedDataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder mergeSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (serializedData_ != null) { + serializedData_ = + com.google.protobuf.Any.newBuilder(serializedData_).mergeFrom(value).buildPartial(); + } else { + serializedData_ = value; + } + onChanged(); + } else { + serializedDataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder clearSerializedData() { + if (serializedDataBuilder_ == null) { + serializedData_ = null; + onChanged(); + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.Any.Builder getSerializedDataBuilder() { + + onChanged(); + return getSerializedDataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + if (serializedDataBuilder_ != null) { + return serializedDataBuilder_.getMessageOrBuilder(); + } else { + return serializedData_ == null ? + com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> + getSerializedDataFieldBuilder() { + if (serializedDataBuilder_ == null) { + serializedDataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( + getSerializedData(), + getParentForChildren(), + isClean()); + serializedData_ = null; + } + return serializedDataBuilder_; + } + @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:tribuo.core.EnsembleCombinerProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.EnsembleCombinerProto) + private static final org.tribuo.protos.core.EnsembleCombinerProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.EnsembleCombinerProto(); + } + + public static org.tribuo.protos.core.EnsembleCombinerProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public EnsembleCombinerProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new EnsembleCombinerProto(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 org.tribuo.protos.core.EnsembleCombinerProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/EnsembleCombinerProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/EnsembleCombinerProtoOrBuilder.java new file mode 100644 index 000000000..55e9d6ea0 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/EnsembleCombinerProtoOrBuilder.java @@ -0,0 +1,42 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface EnsembleCombinerProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.EnsembleCombinerProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + boolean hasSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + com.google.protobuf.Any getSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + */ + com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/ExampleProto.java b/Core/src/main/java/org/tribuo/protos/core/ExampleProto.java new file mode 100644 index 000000000..1770b36b4 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/ExampleProto.java @@ -0,0 +1,1474 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Example proto
+ * 
+ * + * Protobuf type {@code tribuo.core.ExampleProto} + */ +public final class ExampleProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.ExampleProto) + ExampleProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use ExampleProto.newBuilder() to construct. + private ExampleProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ExampleProto() { + className_ = ""; + featureName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + featureValue_ = emptyDoubleList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ExampleProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ExampleProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + org.tribuo.protos.core.OutputProto.Builder subBuilder = null; + if (output_ != null) { + subBuilder = output_.toBuilder(); + } + output_ = input.readMessage(org.tribuo.protos.core.OutputProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(output_); + output_ = subBuilder.buildPartial(); + } + + break; + } + case 34: { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + featureName_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + featureName_.add(s); + break; + } + case 41: { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + featureValue_ = newDoubleList(); + mutable_bitField0_ |= 0x00000002; + } + featureValue_.addDouble(input.readDouble()); + break; + } + case 42: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) { + featureValue_ = newDoubleList(); + mutable_bitField0_ |= 0x00000002; + } + while (input.getBytesUntilLimit() > 0) { + featureValue_.addDouble(input.readDouble()); + } + input.popLimit(limit); + break; + } + case 50: { + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + metadata_ = com.google.protobuf.MapField.newMapField( + MetadataDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000004; + } + com.google.protobuf.MapEntry + metadata__ = input.readMessage( + MetadataDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + metadata_.getMutableMap().put( + metadata__.getKey(), metadata__.getValue()); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + featureName_ = featureName_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + featureValue_.makeImmutable(); // C + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ExampleProto_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 6: + return internalGetMetadata(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ExampleProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.ExampleProto.class, org.tribuo.protos.core.ExampleProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int OUTPUT_FIELD_NUMBER = 3; + private org.tribuo.protos.core.OutputProto output_; + /** + * .tribuo.core.OutputProto output = 3; + * @return Whether the output field is set. + */ + @java.lang.Override + public boolean hasOutput() { + return output_ != null; + } + /** + * .tribuo.core.OutputProto output = 3; + * @return The output. + */ + @java.lang.Override + public org.tribuo.protos.core.OutputProto getOutput() { + return output_ == null ? org.tribuo.protos.core.OutputProto.getDefaultInstance() : output_; + } + /** + * .tribuo.core.OutputProto output = 3; + */ + @java.lang.Override + public org.tribuo.protos.core.OutputProtoOrBuilder getOutputOrBuilder() { + return getOutput(); + } + + public static final int FEATURE_NAME_FIELD_NUMBER = 4; + private com.google.protobuf.LazyStringList featureName_; + /** + * repeated string feature_name = 4; + * @return A list containing the featureName. + */ + public com.google.protobuf.ProtocolStringList + getFeatureNameList() { + return featureName_; + } + /** + * repeated string feature_name = 4; + * @return The count of featureName. + */ + public int getFeatureNameCount() { + return featureName_.size(); + } + /** + * repeated string feature_name = 4; + * @param index The index of the element to return. + * @return The featureName at the given index. + */ + public java.lang.String getFeatureName(int index) { + return featureName_.get(index); + } + /** + * repeated string feature_name = 4; + * @param index The index of the value to return. + * @return The bytes of the featureName at the given index. + */ + public com.google.protobuf.ByteString + getFeatureNameBytes(int index) { + return featureName_.getByteString(index); + } + + public static final int FEATURE_VALUE_FIELD_NUMBER = 5; + private com.google.protobuf.Internal.DoubleList featureValue_; + /** + * repeated double feature_value = 5; + * @return A list containing the featureValue. + */ + @java.lang.Override + public java.util.List + getFeatureValueList() { + return featureValue_; + } + /** + * repeated double feature_value = 5; + * @return The count of featureValue. + */ + public int getFeatureValueCount() { + return featureValue_.size(); + } + /** + * repeated double feature_value = 5; + * @param index The index of the element to return. + * @return The featureValue at the given index. + */ + public double getFeatureValue(int index) { + return featureValue_.getDouble(index); + } + private int featureValueMemoizedSerializedSize = -1; + + public static final int METADATA_FIELD_NUMBER = 6; + private static final class MetadataDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ExampleProto_MetadataEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> metadata_; + private com.google.protobuf.MapField + internalGetMetadata() { + if (metadata_ == null) { + return com.google.protobuf.MapField.emptyMapField( + MetadataDefaultEntryHolder.defaultEntry); + } + return metadata_; + } + + public int getMetadataCount() { + return internalGetMetadata().getMap().size(); + } + /** + * map<string, string> metadata = 6; + */ + + @java.lang.Override + public boolean containsMetadata( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetMetadata().getMap().containsKey(key); + } + /** + * Use {@link #getMetadataMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getMetadata() { + return getMetadataMap(); + } + /** + * map<string, string> metadata = 6; + */ + @java.lang.Override + + public java.util.Map getMetadataMap() { + return internalGetMetadata().getMap(); + } + /** + * map<string, string> metadata = 6; + */ + @java.lang.Override + + public java.lang.String getMetadataOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetMetadata().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, string> metadata = 6; + */ + @java.lang.Override + + public java.lang.String getMetadataOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetMetadata().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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (output_ != null) { + output.writeMessage(3, getOutput()); + } + for (int i = 0; i < featureName_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, featureName_.getRaw(i)); + } + if (getFeatureValueList().size() > 0) { + output.writeUInt32NoTag(42); + output.writeUInt32NoTag(featureValueMemoizedSerializedSize); + } + for (int i = 0; i < featureValue_.size(); i++) { + output.writeDoubleNoTag(featureValue_.getDouble(i)); + } + com.google.protobuf.GeneratedMessageV3 + .serializeStringMapTo( + output, + internalGetMetadata(), + MetadataDefaultEntryHolder.defaultEntry, + 6); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (output_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getOutput()); + } + { + int dataSize = 0; + for (int i = 0; i < featureName_.size(); i++) { + dataSize += computeStringSizeNoTag(featureName_.getRaw(i)); + } + size += dataSize; + size += 1 * getFeatureNameList().size(); + } + { + int dataSize = 0; + dataSize = 8 * getFeatureValueList().size(); + size += dataSize; + if (!getFeatureValueList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + featureValueMemoizedSerializedSize = dataSize; + } + for (java.util.Map.Entry entry + : internalGetMetadata().getMap().entrySet()) { + com.google.protobuf.MapEntry + metadata__ = MetadataDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, metadata__); + } + 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 org.tribuo.protos.core.ExampleProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.ExampleProto other = (org.tribuo.protos.core.ExampleProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasOutput() != other.hasOutput()) return false; + if (hasOutput()) { + if (!getOutput() + .equals(other.getOutput())) return false; + } + if (!getFeatureNameList() + .equals(other.getFeatureNameList())) return false; + if (!getFeatureValueList() + .equals(other.getFeatureValueList())) return false; + if (!internalGetMetadata().equals( + other.internalGetMetadata())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasOutput()) { + hash = (37 * hash) + OUTPUT_FIELD_NUMBER; + hash = (53 * hash) + getOutput().hashCode(); + } + if (getFeatureNameCount() > 0) { + hash = (37 * hash) + FEATURE_NAME_FIELD_NUMBER; + hash = (53 * hash) + getFeatureNameList().hashCode(); + } + if (getFeatureValueCount() > 0) { + hash = (37 * hash) + FEATURE_VALUE_FIELD_NUMBER; + hash = (53 * hash) + getFeatureValueList().hashCode(); + } + if (!internalGetMetadata().getMap().isEmpty()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + internalGetMetadata().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.ExampleProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ExampleProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ExampleProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ExampleProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ExampleProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ExampleProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ExampleProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ExampleProto 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 org.tribuo.protos.core.ExampleProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ExampleProto 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 org.tribuo.protos.core.ExampleProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ExampleProto 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(org.tribuo.protos.core.ExampleProto 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; + } + /** + *
+   *Example proto
+   * 
+ * + * Protobuf type {@code tribuo.core.ExampleProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.ExampleProto) + org.tribuo.protos.core.ExampleProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ExampleProto_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 6: + return internalGetMetadata(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField( + int number) { + switch (number) { + case 6: + return internalGetMutableMetadata(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ExampleProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.ExampleProto.class, org.tribuo.protos.core.ExampleProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.ExampleProto.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(); + version_ = 0; + + className_ = ""; + + if (outputBuilder_ == null) { + output_ = null; + } else { + output_ = null; + outputBuilder_ = null; + } + featureName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + featureValue_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000002); + internalGetMutableMetadata().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ExampleProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.ExampleProto getDefaultInstanceForType() { + return org.tribuo.protos.core.ExampleProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.ExampleProto build() { + org.tribuo.protos.core.ExampleProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.ExampleProto buildPartial() { + org.tribuo.protos.core.ExampleProto result = new org.tribuo.protos.core.ExampleProto(this); + int from_bitField0_ = bitField0_; + result.version_ = version_; + result.className_ = className_; + if (outputBuilder_ == null) { + result.output_ = output_; + } else { + result.output_ = outputBuilder_.build(); + } + if (((bitField0_ & 0x00000001) != 0)) { + featureName_ = featureName_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.featureName_ = featureName_; + if (((bitField0_ & 0x00000002) != 0)) { + featureValue_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.featureValue_ = featureValue_; + result.metadata_ = internalGetMetadata(); + result.metadata_.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 org.tribuo.protos.core.ExampleProto) { + return mergeFrom((org.tribuo.protos.core.ExampleProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.ExampleProto other) { + if (other == org.tribuo.protos.core.ExampleProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasOutput()) { + mergeOutput(other.getOutput()); + } + if (!other.featureName_.isEmpty()) { + if (featureName_.isEmpty()) { + featureName_ = other.featureName_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureFeatureNameIsMutable(); + featureName_.addAll(other.featureName_); + } + onChanged(); + } + if (!other.featureValue_.isEmpty()) { + if (featureValue_.isEmpty()) { + featureValue_ = other.featureValue_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureFeatureValueIsMutable(); + featureValue_.addAll(other.featureValue_); + } + onChanged(); + } + internalGetMutableMetadata().mergeFrom( + other.internalGetMetadata()); + 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 { + org.tribuo.protos.core.ExampleProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.ExampleProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private org.tribuo.protos.core.OutputProto output_; + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputProto, org.tribuo.protos.core.OutputProto.Builder, org.tribuo.protos.core.OutputProtoOrBuilder> outputBuilder_; + /** + * .tribuo.core.OutputProto output = 3; + * @return Whether the output field is set. + */ + public boolean hasOutput() { + return outputBuilder_ != null || output_ != null; + } + /** + * .tribuo.core.OutputProto output = 3; + * @return The output. + */ + public org.tribuo.protos.core.OutputProto getOutput() { + if (outputBuilder_ == null) { + return output_ == null ? org.tribuo.protos.core.OutputProto.getDefaultInstance() : output_; + } else { + return outputBuilder_.getMessage(); + } + } + /** + * .tribuo.core.OutputProto output = 3; + */ + public Builder setOutput(org.tribuo.protos.core.OutputProto value) { + if (outputBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + output_ = value; + onChanged(); + } else { + outputBuilder_.setMessage(value); + } + + return this; + } + /** + * .tribuo.core.OutputProto output = 3; + */ + public Builder setOutput( + org.tribuo.protos.core.OutputProto.Builder builderForValue) { + if (outputBuilder_ == null) { + output_ = builderForValue.build(); + onChanged(); + } else { + outputBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .tribuo.core.OutputProto output = 3; + */ + public Builder mergeOutput(org.tribuo.protos.core.OutputProto value) { + if (outputBuilder_ == null) { + if (output_ != null) { + output_ = + org.tribuo.protos.core.OutputProto.newBuilder(output_).mergeFrom(value).buildPartial(); + } else { + output_ = value; + } + onChanged(); + } else { + outputBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .tribuo.core.OutputProto output = 3; + */ + public Builder clearOutput() { + if (outputBuilder_ == null) { + output_ = null; + onChanged(); + } else { + output_ = null; + outputBuilder_ = null; + } + + return this; + } + /** + * .tribuo.core.OutputProto output = 3; + */ + public org.tribuo.protos.core.OutputProto.Builder getOutputBuilder() { + + onChanged(); + return getOutputFieldBuilder().getBuilder(); + } + /** + * .tribuo.core.OutputProto output = 3; + */ + public org.tribuo.protos.core.OutputProtoOrBuilder getOutputOrBuilder() { + if (outputBuilder_ != null) { + return outputBuilder_.getMessageOrBuilder(); + } else { + return output_ == null ? + org.tribuo.protos.core.OutputProto.getDefaultInstance() : output_; + } + } + /** + * .tribuo.core.OutputProto output = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputProto, org.tribuo.protos.core.OutputProto.Builder, org.tribuo.protos.core.OutputProtoOrBuilder> + getOutputFieldBuilder() { + if (outputBuilder_ == null) { + outputBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputProto, org.tribuo.protos.core.OutputProto.Builder, org.tribuo.protos.core.OutputProtoOrBuilder>( + getOutput(), + getParentForChildren(), + isClean()); + output_ = null; + } + return outputBuilder_; + } + + private com.google.protobuf.LazyStringList featureName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureFeatureNameIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + featureName_ = new com.google.protobuf.LazyStringArrayList(featureName_); + bitField0_ |= 0x00000001; + } + } + /** + * repeated string feature_name = 4; + * @return A list containing the featureName. + */ + public com.google.protobuf.ProtocolStringList + getFeatureNameList() { + return featureName_.getUnmodifiableView(); + } + /** + * repeated string feature_name = 4; + * @return The count of featureName. + */ + public int getFeatureNameCount() { + return featureName_.size(); + } + /** + * repeated string feature_name = 4; + * @param index The index of the element to return. + * @return The featureName at the given index. + */ + public java.lang.String getFeatureName(int index) { + return featureName_.get(index); + } + /** + * repeated string feature_name = 4; + * @param index The index of the value to return. + * @return The bytes of the featureName at the given index. + */ + public com.google.protobuf.ByteString + getFeatureNameBytes(int index) { + return featureName_.getByteString(index); + } + /** + * repeated string feature_name = 4; + * @param index The index to set the value at. + * @param value The featureName to set. + * @return This builder for chaining. + */ + public Builder setFeatureName( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureFeatureNameIsMutable(); + featureName_.set(index, value); + onChanged(); + return this; + } + /** + * repeated string feature_name = 4; + * @param value The featureName to add. + * @return This builder for chaining. + */ + public Builder addFeatureName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureFeatureNameIsMutable(); + featureName_.add(value); + onChanged(); + return this; + } + /** + * repeated string feature_name = 4; + * @param values The featureName to add. + * @return This builder for chaining. + */ + public Builder addAllFeatureName( + java.lang.Iterable values) { + ensureFeatureNameIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, featureName_); + onChanged(); + return this; + } + /** + * repeated string feature_name = 4; + * @return This builder for chaining. + */ + public Builder clearFeatureName() { + featureName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * repeated string feature_name = 4; + * @param value The bytes of the featureName to add. + * @return This builder for chaining. + */ + public Builder addFeatureNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureFeatureNameIsMutable(); + featureName_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.DoubleList featureValue_ = emptyDoubleList(); + private void ensureFeatureValueIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + featureValue_ = mutableCopy(featureValue_); + bitField0_ |= 0x00000002; + } + } + /** + * repeated double feature_value = 5; + * @return A list containing the featureValue. + */ + public java.util.List + getFeatureValueList() { + return ((bitField0_ & 0x00000002) != 0) ? + java.util.Collections.unmodifiableList(featureValue_) : featureValue_; + } + /** + * repeated double feature_value = 5; + * @return The count of featureValue. + */ + public int getFeatureValueCount() { + return featureValue_.size(); + } + /** + * repeated double feature_value = 5; + * @param index The index of the element to return. + * @return The featureValue at the given index. + */ + public double getFeatureValue(int index) { + return featureValue_.getDouble(index); + } + /** + * repeated double feature_value = 5; + * @param index The index to set the value at. + * @param value The featureValue to set. + * @return This builder for chaining. + */ + public Builder setFeatureValue( + int index, double value) { + ensureFeatureValueIsMutable(); + featureValue_.setDouble(index, value); + onChanged(); + return this; + } + /** + * repeated double feature_value = 5; + * @param value The featureValue to add. + * @return This builder for chaining. + */ + public Builder addFeatureValue(double value) { + ensureFeatureValueIsMutable(); + featureValue_.addDouble(value); + onChanged(); + return this; + } + /** + * repeated double feature_value = 5; + * @param values The featureValue to add. + * @return This builder for chaining. + */ + public Builder addAllFeatureValue( + java.lang.Iterable values) { + ensureFeatureValueIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, featureValue_); + onChanged(); + return this; + } + /** + * repeated double feature_value = 5; + * @return This builder for chaining. + */ + public Builder clearFeatureValue() { + featureValue_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> metadata_; + private com.google.protobuf.MapField + internalGetMetadata() { + if (metadata_ == null) { + return com.google.protobuf.MapField.emptyMapField( + MetadataDefaultEntryHolder.defaultEntry); + } + return metadata_; + } + private com.google.protobuf.MapField + internalGetMutableMetadata() { + onChanged();; + if (metadata_ == null) { + metadata_ = com.google.protobuf.MapField.newMapField( + MetadataDefaultEntryHolder.defaultEntry); + } + if (!metadata_.isMutable()) { + metadata_ = metadata_.copy(); + } + return metadata_; + } + + public int getMetadataCount() { + return internalGetMetadata().getMap().size(); + } + /** + * map<string, string> metadata = 6; + */ + + @java.lang.Override + public boolean containsMetadata( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetMetadata().getMap().containsKey(key); + } + /** + * Use {@link #getMetadataMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getMetadata() { + return getMetadataMap(); + } + /** + * map<string, string> metadata = 6; + */ + @java.lang.Override + + public java.util.Map getMetadataMap() { + return internalGetMetadata().getMap(); + } + /** + * map<string, string> metadata = 6; + */ + @java.lang.Override + + public java.lang.String getMetadataOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetMetadata().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, string> metadata = 6; + */ + @java.lang.Override + + public java.lang.String getMetadataOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetMetadata().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearMetadata() { + internalGetMutableMetadata().getMutableMap() + .clear(); + return this; + } + /** + * map<string, string> metadata = 6; + */ + + public Builder removeMetadata( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableMetadata().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableMetadata() { + return internalGetMutableMetadata().getMutableMap(); + } + /** + * map<string, string> metadata = 6; + */ + public Builder putMetadata( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { + throw new NullPointerException("map value"); +} + + internalGetMutableMetadata().getMutableMap() + .put(key, value); + return this; + } + /** + * map<string, string> metadata = 6; + */ + + public Builder putAllMetadata( + java.util.Map values) { + internalGetMutableMetadata().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:tribuo.core.ExampleProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.ExampleProto) + private static final org.tribuo.protos.core.ExampleProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.ExampleProto(); + } + + public static org.tribuo.protos.core.ExampleProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExampleProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ExampleProto(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 org.tribuo.protos.core.ExampleProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/ExampleProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/ExampleProtoOrBuilder.java new file mode 100644 index 000000000..c55ed1288 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/ExampleProtoOrBuilder.java @@ -0,0 +1,120 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface ExampleProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.ExampleProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .tribuo.core.OutputProto output = 3; + * @return Whether the output field is set. + */ + boolean hasOutput(); + /** + * .tribuo.core.OutputProto output = 3; + * @return The output. + */ + org.tribuo.protos.core.OutputProto getOutput(); + /** + * .tribuo.core.OutputProto output = 3; + */ + org.tribuo.protos.core.OutputProtoOrBuilder getOutputOrBuilder(); + + /** + * repeated string feature_name = 4; + * @return A list containing the featureName. + */ + java.util.List + getFeatureNameList(); + /** + * repeated string feature_name = 4; + * @return The count of featureName. + */ + int getFeatureNameCount(); + /** + * repeated string feature_name = 4; + * @param index The index of the element to return. + * @return The featureName at the given index. + */ + java.lang.String getFeatureName(int index); + /** + * repeated string feature_name = 4; + * @param index The index of the value to return. + * @return The bytes of the featureName at the given index. + */ + com.google.protobuf.ByteString + getFeatureNameBytes(int index); + + /** + * repeated double feature_value = 5; + * @return A list containing the featureValue. + */ + java.util.List getFeatureValueList(); + /** + * repeated double feature_value = 5; + * @return The count of featureValue. + */ + int getFeatureValueCount(); + /** + * repeated double feature_value = 5; + * @param index The index of the element to return. + * @return The featureValue at the given index. + */ + double getFeatureValue(int index); + + /** + * map<string, string> metadata = 6; + */ + int getMetadataCount(); + /** + * map<string, string> metadata = 6; + */ + boolean containsMetadata( + java.lang.String key); + /** + * Use {@link #getMetadataMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getMetadata(); + /** + * map<string, string> metadata = 6; + */ + java.util.Map + getMetadataMap(); + /** + * map<string, string> metadata = 6; + */ + + /* nullable */ +java.lang.String getMetadataOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue); + /** + * map<string, string> metadata = 6; + */ + + java.lang.String getMetadataOrThrow( + java.lang.String key); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/FeatureDomainProto.java b/Core/src/main/java/org/tribuo/protos/core/FeatureDomainProto.java new file mode 100644 index 000000000..0ee551635 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/FeatureDomainProto.java @@ -0,0 +1,819 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Feature domain redirection proto
+ * 
+ * + * Protobuf type {@code tribuo.core.FeatureDomainProto} + */ +public final class FeatureDomainProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.FeatureDomainProto) + FeatureDomainProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use FeatureDomainProto.newBuilder() to construct. + private FeatureDomainProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private FeatureDomainProto() { + className_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new FeatureDomainProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private FeatureDomainProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + com.google.protobuf.Any.Builder subBuilder = null; + if (serializedData_ != null) { + subBuilder = serializedData_.toBuilder(); + } + serializedData_ = input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(serializedData_); + serializedData_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_FeatureDomainProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_FeatureDomainProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.FeatureDomainProto.class, org.tribuo.protos.core.FeatureDomainProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERIALIZED_DATA_FIELD_NUMBER = 3; + private com.google.protobuf.Any serializedData_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + @java.lang.Override + public boolean hasSerializedData() { + return serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + @java.lang.Override + public com.google.protobuf.Any getSerializedData() { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + @java.lang.Override + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + return getSerializedData(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (serializedData_ != null) { + output.writeMessage(3, getSerializedData()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (serializedData_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getSerializedData()); + } + 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 org.tribuo.protos.core.FeatureDomainProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.FeatureDomainProto other = (org.tribuo.protos.core.FeatureDomainProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasSerializedData() != other.hasSerializedData()) return false; + if (hasSerializedData()) { + if (!getSerializedData() + .equals(other.getSerializedData())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasSerializedData()) { + hash = (37 * hash) + SERIALIZED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getSerializedData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.FeatureDomainProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.FeatureDomainProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.FeatureDomainProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.FeatureDomainProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.FeatureDomainProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.FeatureDomainProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.FeatureDomainProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.FeatureDomainProto 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 org.tribuo.protos.core.FeatureDomainProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.FeatureDomainProto 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 org.tribuo.protos.core.FeatureDomainProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.FeatureDomainProto 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(org.tribuo.protos.core.FeatureDomainProto 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; + } + /** + *
+   *Feature domain redirection proto
+   * 
+ * + * Protobuf type {@code tribuo.core.FeatureDomainProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.FeatureDomainProto) + org.tribuo.protos.core.FeatureDomainProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_FeatureDomainProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_FeatureDomainProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.FeatureDomainProto.class, org.tribuo.protos.core.FeatureDomainProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.FeatureDomainProto.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(); + version_ = 0; + + className_ = ""; + + if (serializedDataBuilder_ == null) { + serializedData_ = null; + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_FeatureDomainProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.FeatureDomainProto getDefaultInstanceForType() { + return org.tribuo.protos.core.FeatureDomainProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.FeatureDomainProto build() { + org.tribuo.protos.core.FeatureDomainProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.FeatureDomainProto buildPartial() { + org.tribuo.protos.core.FeatureDomainProto result = new org.tribuo.protos.core.FeatureDomainProto(this); + result.version_ = version_; + result.className_ = className_; + if (serializedDataBuilder_ == null) { + result.serializedData_ = serializedData_; + } else { + result.serializedData_ = serializedDataBuilder_.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 org.tribuo.protos.core.FeatureDomainProto) { + return mergeFrom((org.tribuo.protos.core.FeatureDomainProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.FeatureDomainProto other) { + if (other == org.tribuo.protos.core.FeatureDomainProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasSerializedData()) { + mergeSerializedData(other.getSerializedData()); + } + 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 { + org.tribuo.protos.core.FeatureDomainProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.FeatureDomainProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Any serializedData_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> serializedDataBuilder_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + public boolean hasSerializedData() { + return serializedDataBuilder_ != null || serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + public com.google.protobuf.Any getSerializedData() { + if (serializedDataBuilder_ == null) { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } else { + return serializedDataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + serializedData_ = value; + onChanged(); + } else { + serializedDataBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData( + com.google.protobuf.Any.Builder builderForValue) { + if (serializedDataBuilder_ == null) { + serializedData_ = builderForValue.build(); + onChanged(); + } else { + serializedDataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder mergeSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (serializedData_ != null) { + serializedData_ = + com.google.protobuf.Any.newBuilder(serializedData_).mergeFrom(value).buildPartial(); + } else { + serializedData_ = value; + } + onChanged(); + } else { + serializedDataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder clearSerializedData() { + if (serializedDataBuilder_ == null) { + serializedData_ = null; + onChanged(); + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.Any.Builder getSerializedDataBuilder() { + + onChanged(); + return getSerializedDataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + if (serializedDataBuilder_ != null) { + return serializedDataBuilder_.getMessageOrBuilder(); + } else { + return serializedData_ == null ? + com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> + getSerializedDataFieldBuilder() { + if (serializedDataBuilder_ == null) { + serializedDataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( + getSerializedData(), + getParentForChildren(), + isClean()); + serializedData_ = null; + } + return serializedDataBuilder_; + } + @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:tribuo.core.FeatureDomainProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.FeatureDomainProto) + private static final org.tribuo.protos.core.FeatureDomainProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.FeatureDomainProto(); + } + + public static org.tribuo.protos.core.FeatureDomainProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public FeatureDomainProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new FeatureDomainProto(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 org.tribuo.protos.core.FeatureDomainProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/FeatureDomainProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/FeatureDomainProtoOrBuilder.java new file mode 100644 index 000000000..4fd0df069 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/FeatureDomainProtoOrBuilder.java @@ -0,0 +1,42 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface FeatureDomainProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.FeatureDomainProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + boolean hasSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + com.google.protobuf.Any getSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + */ + com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/HashedFeatureMapProto.java b/Core/src/main/java/org/tribuo/protos/core/HashedFeatureMapProto.java new file mode 100644 index 000000000..bca1fcf27 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/HashedFeatureMapProto.java @@ -0,0 +1,968 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *HashedFeatureMap proto
+ * 
+ * + * Protobuf type {@code tribuo.core.HashedFeatureMapProto} + */ +public final class HashedFeatureMapProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.HashedFeatureMapProto) + HashedFeatureMapProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use HashedFeatureMapProto.newBuilder() to construct. + private HashedFeatureMapProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private HashedFeatureMapProto() { + info_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new HashedFeatureMapProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private HashedFeatureMapProto( + 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: { + org.tribuo.protos.core.HasherProto.Builder subBuilder = null; + if (hasher_ != null) { + subBuilder = hasher_.toBuilder(); + } + hasher_ = input.readMessage(org.tribuo.protos.core.HasherProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(hasher_); + hasher_ = subBuilder.buildPartial(); + } + + break; + } + case 18: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + info_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + info_.add( + input.readMessage(org.tribuo.protos.core.VariableInfoProto.parser(), extensionRegistry)); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + info_ = java.util.Collections.unmodifiableList(info_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_HashedFeatureMapProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_HashedFeatureMapProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.HashedFeatureMapProto.class, org.tribuo.protos.core.HashedFeatureMapProto.Builder.class); + } + + public static final int HASHER_FIELD_NUMBER = 1; + private org.tribuo.protos.core.HasherProto hasher_; + /** + * .tribuo.core.HasherProto hasher = 1; + * @return Whether the hasher field is set. + */ + @java.lang.Override + public boolean hasHasher() { + return hasher_ != null; + } + /** + * .tribuo.core.HasherProto hasher = 1; + * @return The hasher. + */ + @java.lang.Override + public org.tribuo.protos.core.HasherProto getHasher() { + return hasher_ == null ? org.tribuo.protos.core.HasherProto.getDefaultInstance() : hasher_; + } + /** + * .tribuo.core.HasherProto hasher = 1; + */ + @java.lang.Override + public org.tribuo.protos.core.HasherProtoOrBuilder getHasherOrBuilder() { + return getHasher(); + } + + public static final int INFO_FIELD_NUMBER = 2; + private java.util.List info_; + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + @java.lang.Override + public java.util.List getInfoList() { + return info_; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + @java.lang.Override + public java.util.List + getInfoOrBuilderList() { + return info_; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + @java.lang.Override + public int getInfoCount() { + return info_.size(); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + @java.lang.Override + public org.tribuo.protos.core.VariableInfoProto getInfo(int index) { + return info_.get(index); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + @java.lang.Override + public org.tribuo.protos.core.VariableInfoProtoOrBuilder getInfoOrBuilder( + int index) { + return info_.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 { + if (hasher_ != null) { + output.writeMessage(1, getHasher()); + } + for (int i = 0; i < info_.size(); i++) { + output.writeMessage(2, info_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (hasher_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getHasher()); + } + for (int i = 0; i < info_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, info_.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 org.tribuo.protos.core.HashedFeatureMapProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.HashedFeatureMapProto other = (org.tribuo.protos.core.HashedFeatureMapProto) obj; + + if (hasHasher() != other.hasHasher()) return false; + if (hasHasher()) { + if (!getHasher() + .equals(other.getHasher())) return false; + } + if (!getInfoList() + .equals(other.getInfoList())) 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 (hasHasher()) { + hash = (37 * hash) + HASHER_FIELD_NUMBER; + hash = (53 * hash) + getHasher().hashCode(); + } + if (getInfoCount() > 0) { + hash = (37 * hash) + INFO_FIELD_NUMBER; + hash = (53 * hash) + getInfoList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.HashedFeatureMapProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.HashedFeatureMapProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.HashedFeatureMapProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.HashedFeatureMapProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.HashedFeatureMapProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.HashedFeatureMapProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.HashedFeatureMapProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.HashedFeatureMapProto 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 org.tribuo.protos.core.HashedFeatureMapProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.HashedFeatureMapProto 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 org.tribuo.protos.core.HashedFeatureMapProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.HashedFeatureMapProto 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(org.tribuo.protos.core.HashedFeatureMapProto 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; + } + /** + *
+   *HashedFeatureMap proto
+   * 
+ * + * Protobuf type {@code tribuo.core.HashedFeatureMapProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.HashedFeatureMapProto) + org.tribuo.protos.core.HashedFeatureMapProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_HashedFeatureMapProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_HashedFeatureMapProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.HashedFeatureMapProto.class, org.tribuo.protos.core.HashedFeatureMapProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.HashedFeatureMapProto.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getInfoFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (hasherBuilder_ == null) { + hasher_ = null; + } else { + hasher_ = null; + hasherBuilder_ = null; + } + if (infoBuilder_ == null) { + info_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + infoBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_HashedFeatureMapProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.HashedFeatureMapProto getDefaultInstanceForType() { + return org.tribuo.protos.core.HashedFeatureMapProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.HashedFeatureMapProto build() { + org.tribuo.protos.core.HashedFeatureMapProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.HashedFeatureMapProto buildPartial() { + org.tribuo.protos.core.HashedFeatureMapProto result = new org.tribuo.protos.core.HashedFeatureMapProto(this); + int from_bitField0_ = bitField0_; + if (hasherBuilder_ == null) { + result.hasher_ = hasher_; + } else { + result.hasher_ = hasherBuilder_.build(); + } + if (infoBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + info_ = java.util.Collections.unmodifiableList(info_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.info_ = info_; + } else { + result.info_ = infoBuilder_.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 org.tribuo.protos.core.HashedFeatureMapProto) { + return mergeFrom((org.tribuo.protos.core.HashedFeatureMapProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.HashedFeatureMapProto other) { + if (other == org.tribuo.protos.core.HashedFeatureMapProto.getDefaultInstance()) return this; + if (other.hasHasher()) { + mergeHasher(other.getHasher()); + } + if (infoBuilder_ == null) { + if (!other.info_.isEmpty()) { + if (info_.isEmpty()) { + info_ = other.info_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureInfoIsMutable(); + info_.addAll(other.info_); + } + onChanged(); + } + } else { + if (!other.info_.isEmpty()) { + if (infoBuilder_.isEmpty()) { + infoBuilder_.dispose(); + infoBuilder_ = null; + info_ = other.info_; + bitField0_ = (bitField0_ & ~0x00000001); + infoBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getInfoFieldBuilder() : null; + } else { + infoBuilder_.addAllMessages(other.info_); + } + } + } + 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 { + org.tribuo.protos.core.HashedFeatureMapProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.HashedFeatureMapProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private org.tribuo.protos.core.HasherProto hasher_; + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.HasherProto, org.tribuo.protos.core.HasherProto.Builder, org.tribuo.protos.core.HasherProtoOrBuilder> hasherBuilder_; + /** + * .tribuo.core.HasherProto hasher = 1; + * @return Whether the hasher field is set. + */ + public boolean hasHasher() { + return hasherBuilder_ != null || hasher_ != null; + } + /** + * .tribuo.core.HasherProto hasher = 1; + * @return The hasher. + */ + public org.tribuo.protos.core.HasherProto getHasher() { + if (hasherBuilder_ == null) { + return hasher_ == null ? org.tribuo.protos.core.HasherProto.getDefaultInstance() : hasher_; + } else { + return hasherBuilder_.getMessage(); + } + } + /** + * .tribuo.core.HasherProto hasher = 1; + */ + public Builder setHasher(org.tribuo.protos.core.HasherProto value) { + if (hasherBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + hasher_ = value; + onChanged(); + } else { + hasherBuilder_.setMessage(value); + } + + return this; + } + /** + * .tribuo.core.HasherProto hasher = 1; + */ + public Builder setHasher( + org.tribuo.protos.core.HasherProto.Builder builderForValue) { + if (hasherBuilder_ == null) { + hasher_ = builderForValue.build(); + onChanged(); + } else { + hasherBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .tribuo.core.HasherProto hasher = 1; + */ + public Builder mergeHasher(org.tribuo.protos.core.HasherProto value) { + if (hasherBuilder_ == null) { + if (hasher_ != null) { + hasher_ = + org.tribuo.protos.core.HasherProto.newBuilder(hasher_).mergeFrom(value).buildPartial(); + } else { + hasher_ = value; + } + onChanged(); + } else { + hasherBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .tribuo.core.HasherProto hasher = 1; + */ + public Builder clearHasher() { + if (hasherBuilder_ == null) { + hasher_ = null; + onChanged(); + } else { + hasher_ = null; + hasherBuilder_ = null; + } + + return this; + } + /** + * .tribuo.core.HasherProto hasher = 1; + */ + public org.tribuo.protos.core.HasherProto.Builder getHasherBuilder() { + + onChanged(); + return getHasherFieldBuilder().getBuilder(); + } + /** + * .tribuo.core.HasherProto hasher = 1; + */ + public org.tribuo.protos.core.HasherProtoOrBuilder getHasherOrBuilder() { + if (hasherBuilder_ != null) { + return hasherBuilder_.getMessageOrBuilder(); + } else { + return hasher_ == null ? + org.tribuo.protos.core.HasherProto.getDefaultInstance() : hasher_; + } + } + /** + * .tribuo.core.HasherProto hasher = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.HasherProto, org.tribuo.protos.core.HasherProto.Builder, org.tribuo.protos.core.HasherProtoOrBuilder> + getHasherFieldBuilder() { + if (hasherBuilder_ == null) { + hasherBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.HasherProto, org.tribuo.protos.core.HasherProto.Builder, org.tribuo.protos.core.HasherProtoOrBuilder>( + getHasher(), + getParentForChildren(), + isClean()); + hasher_ = null; + } + return hasherBuilder_; + } + + private java.util.List info_ = + java.util.Collections.emptyList(); + private void ensureInfoIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + info_ = new java.util.ArrayList(info_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.VariableInfoProto, org.tribuo.protos.core.VariableInfoProto.Builder, org.tribuo.protos.core.VariableInfoProtoOrBuilder> infoBuilder_; + + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public java.util.List getInfoList() { + if (infoBuilder_ == null) { + return java.util.Collections.unmodifiableList(info_); + } else { + return infoBuilder_.getMessageList(); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public int getInfoCount() { + if (infoBuilder_ == null) { + return info_.size(); + } else { + return infoBuilder_.getCount(); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public org.tribuo.protos.core.VariableInfoProto getInfo(int index) { + if (infoBuilder_ == null) { + return info_.get(index); + } else { + return infoBuilder_.getMessage(index); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder setInfo( + int index, org.tribuo.protos.core.VariableInfoProto value) { + if (infoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInfoIsMutable(); + info_.set(index, value); + onChanged(); + } else { + infoBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder setInfo( + int index, org.tribuo.protos.core.VariableInfoProto.Builder builderForValue) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.set(index, builderForValue.build()); + onChanged(); + } else { + infoBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder addInfo(org.tribuo.protos.core.VariableInfoProto value) { + if (infoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInfoIsMutable(); + info_.add(value); + onChanged(); + } else { + infoBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder addInfo( + int index, org.tribuo.protos.core.VariableInfoProto value) { + if (infoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInfoIsMutable(); + info_.add(index, value); + onChanged(); + } else { + infoBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder addInfo( + org.tribuo.protos.core.VariableInfoProto.Builder builderForValue) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.add(builderForValue.build()); + onChanged(); + } else { + infoBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder addInfo( + int index, org.tribuo.protos.core.VariableInfoProto.Builder builderForValue) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.add(index, builderForValue.build()); + onChanged(); + } else { + infoBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder addAllInfo( + java.lang.Iterable values) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, info_); + onChanged(); + } else { + infoBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder clearInfo() { + if (infoBuilder_ == null) { + info_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + infoBuilder_.clear(); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder removeInfo(int index) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.remove(index); + onChanged(); + } else { + infoBuilder_.remove(index); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public org.tribuo.protos.core.VariableInfoProto.Builder getInfoBuilder( + int index) { + return getInfoFieldBuilder().getBuilder(index); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public org.tribuo.protos.core.VariableInfoProtoOrBuilder getInfoOrBuilder( + int index) { + if (infoBuilder_ == null) { + return info_.get(index); } else { + return infoBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public java.util.List + getInfoOrBuilderList() { + if (infoBuilder_ != null) { + return infoBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(info_); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public org.tribuo.protos.core.VariableInfoProto.Builder addInfoBuilder() { + return getInfoFieldBuilder().addBuilder( + org.tribuo.protos.core.VariableInfoProto.getDefaultInstance()); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public org.tribuo.protos.core.VariableInfoProto.Builder addInfoBuilder( + int index) { + return getInfoFieldBuilder().addBuilder( + index, org.tribuo.protos.core.VariableInfoProto.getDefaultInstance()); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public java.util.List + getInfoBuilderList() { + return getInfoFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.VariableInfoProto, org.tribuo.protos.core.VariableInfoProto.Builder, org.tribuo.protos.core.VariableInfoProtoOrBuilder> + getInfoFieldBuilder() { + if (infoBuilder_ == null) { + infoBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.VariableInfoProto, org.tribuo.protos.core.VariableInfoProto.Builder, org.tribuo.protos.core.VariableInfoProtoOrBuilder>( + info_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + info_ = null; + } + return infoBuilder_; + } + @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:tribuo.core.HashedFeatureMapProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.HashedFeatureMapProto) + private static final org.tribuo.protos.core.HashedFeatureMapProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.HashedFeatureMapProto(); + } + + public static org.tribuo.protos.core.HashedFeatureMapProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public HashedFeatureMapProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new HashedFeatureMapProto(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 org.tribuo.protos.core.HashedFeatureMapProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/HashedFeatureMapProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/HashedFeatureMapProtoOrBuilder.java new file mode 100644 index 000000000..0e4023ea4 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/HashedFeatureMapProtoOrBuilder.java @@ -0,0 +1,48 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface HashedFeatureMapProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.HashedFeatureMapProto) + com.google.protobuf.MessageOrBuilder { + + /** + * .tribuo.core.HasherProto hasher = 1; + * @return Whether the hasher field is set. + */ + boolean hasHasher(); + /** + * .tribuo.core.HasherProto hasher = 1; + * @return The hasher. + */ + org.tribuo.protos.core.HasherProto getHasher(); + /** + * .tribuo.core.HasherProto hasher = 1; + */ + org.tribuo.protos.core.HasherProtoOrBuilder getHasherOrBuilder(); + + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + java.util.List + getInfoList(); + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + org.tribuo.protos.core.VariableInfoProto getInfo(int index); + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + int getInfoCount(); + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + java.util.List + getInfoOrBuilderList(); + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + org.tribuo.protos.core.VariableInfoProtoOrBuilder getInfoOrBuilder( + int index); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/HasherProto.java b/Core/src/main/java/org/tribuo/protos/core/HasherProto.java new file mode 100644 index 000000000..1433232d8 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/HasherProto.java @@ -0,0 +1,819 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Hasher redirection proto
+ * 
+ * + * Protobuf type {@code tribuo.core.HasherProto} + */ +public final class HasherProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.HasherProto) + HasherProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use HasherProto.newBuilder() to construct. + private HasherProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private HasherProto() { + className_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new HasherProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private HasherProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + com.google.protobuf.Any.Builder subBuilder = null; + if (serializedData_ != null) { + subBuilder = serializedData_.toBuilder(); + } + serializedData_ = input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(serializedData_); + serializedData_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_HasherProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_HasherProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.HasherProto.class, org.tribuo.protos.core.HasherProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERIALIZED_DATA_FIELD_NUMBER = 3; + private com.google.protobuf.Any serializedData_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + @java.lang.Override + public boolean hasSerializedData() { + return serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + @java.lang.Override + public com.google.protobuf.Any getSerializedData() { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + @java.lang.Override + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + return getSerializedData(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (serializedData_ != null) { + output.writeMessage(3, getSerializedData()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (serializedData_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getSerializedData()); + } + 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 org.tribuo.protos.core.HasherProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.HasherProto other = (org.tribuo.protos.core.HasherProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasSerializedData() != other.hasSerializedData()) return false; + if (hasSerializedData()) { + if (!getSerializedData() + .equals(other.getSerializedData())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasSerializedData()) { + hash = (37 * hash) + SERIALIZED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getSerializedData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.HasherProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.HasherProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.HasherProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.HasherProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.HasherProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.HasherProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.HasherProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.HasherProto 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 org.tribuo.protos.core.HasherProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.HasherProto 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 org.tribuo.protos.core.HasherProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.HasherProto 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(org.tribuo.protos.core.HasherProto 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; + } + /** + *
+   *Hasher redirection proto
+   * 
+ * + * Protobuf type {@code tribuo.core.HasherProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.HasherProto) + org.tribuo.protos.core.HasherProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_HasherProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_HasherProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.HasherProto.class, org.tribuo.protos.core.HasherProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.HasherProto.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(); + version_ = 0; + + className_ = ""; + + if (serializedDataBuilder_ == null) { + serializedData_ = null; + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_HasherProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.HasherProto getDefaultInstanceForType() { + return org.tribuo.protos.core.HasherProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.HasherProto build() { + org.tribuo.protos.core.HasherProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.HasherProto buildPartial() { + org.tribuo.protos.core.HasherProto result = new org.tribuo.protos.core.HasherProto(this); + result.version_ = version_; + result.className_ = className_; + if (serializedDataBuilder_ == null) { + result.serializedData_ = serializedData_; + } else { + result.serializedData_ = serializedDataBuilder_.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 org.tribuo.protos.core.HasherProto) { + return mergeFrom((org.tribuo.protos.core.HasherProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.HasherProto other) { + if (other == org.tribuo.protos.core.HasherProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasSerializedData()) { + mergeSerializedData(other.getSerializedData()); + } + 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 { + org.tribuo.protos.core.HasherProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.HasherProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Any serializedData_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> serializedDataBuilder_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + public boolean hasSerializedData() { + return serializedDataBuilder_ != null || serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + public com.google.protobuf.Any getSerializedData() { + if (serializedDataBuilder_ == null) { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } else { + return serializedDataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + serializedData_ = value; + onChanged(); + } else { + serializedDataBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData( + com.google.protobuf.Any.Builder builderForValue) { + if (serializedDataBuilder_ == null) { + serializedData_ = builderForValue.build(); + onChanged(); + } else { + serializedDataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder mergeSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (serializedData_ != null) { + serializedData_ = + com.google.protobuf.Any.newBuilder(serializedData_).mergeFrom(value).buildPartial(); + } else { + serializedData_ = value; + } + onChanged(); + } else { + serializedDataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder clearSerializedData() { + if (serializedDataBuilder_ == null) { + serializedData_ = null; + onChanged(); + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.Any.Builder getSerializedDataBuilder() { + + onChanged(); + return getSerializedDataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + if (serializedDataBuilder_ != null) { + return serializedDataBuilder_.getMessageOrBuilder(); + } else { + return serializedData_ == null ? + com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> + getSerializedDataFieldBuilder() { + if (serializedDataBuilder_ == null) { + serializedDataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( + getSerializedData(), + getParentForChildren(), + isClean()); + serializedData_ = null; + } + return serializedDataBuilder_; + } + @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:tribuo.core.HasherProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.HasherProto) + private static final org.tribuo.protos.core.HasherProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.HasherProto(); + } + + public static org.tribuo.protos.core.HasherProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public HasherProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new HasherProto(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 org.tribuo.protos.core.HasherProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/HasherProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/HasherProtoOrBuilder.java new file mode 100644 index 000000000..6e97dc89f --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/HasherProtoOrBuilder.java @@ -0,0 +1,42 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface HasherProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.HasherProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + boolean hasSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + com.google.protobuf.Any getSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + */ + com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/IDFTransformerProto.java b/Core/src/main/java/org/tribuo/protos/core/IDFTransformerProto.java new file mode 100644 index 000000000..66888aeb1 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/IDFTransformerProto.java @@ -0,0 +1,561 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *IDFTransformer proto
+ * 
+ * + * Protobuf type {@code tribuo.core.IDFTransformerProto} + */ +public final class IDFTransformerProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.IDFTransformerProto) + IDFTransformerProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use IDFTransformerProto.newBuilder() to construct. + private IDFTransformerProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private IDFTransformerProto() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new IDFTransformerProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private IDFTransformerProto( + 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 9: { + + df_ = input.readDouble(); + break; + } + case 17: { + + n_ = input.readDouble(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_IDFTransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_IDFTransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.IDFTransformerProto.class, org.tribuo.protos.core.IDFTransformerProto.Builder.class); + } + + public static final int DF_FIELD_NUMBER = 1; + private double df_; + /** + * double df = 1; + * @return The df. + */ + @java.lang.Override + public double getDf() { + return df_; + } + + public static final int N_FIELD_NUMBER = 2; + private double n_; + /** + * double N = 2; + * @return The n. + */ + @java.lang.Override + public double getN() { + return n_; + } + + 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 (java.lang.Double.doubleToRawLongBits(df_) != 0) { + output.writeDouble(1, df_); + } + if (java.lang.Double.doubleToRawLongBits(n_) != 0) { + output.writeDouble(2, n_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (java.lang.Double.doubleToRawLongBits(df_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(1, df_); + } + if (java.lang.Double.doubleToRawLongBits(n_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(2, n_); + } + 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 org.tribuo.protos.core.IDFTransformerProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.IDFTransformerProto other = (org.tribuo.protos.core.IDFTransformerProto) obj; + + if (java.lang.Double.doubleToLongBits(getDf()) + != java.lang.Double.doubleToLongBits( + other.getDf())) return false; + if (java.lang.Double.doubleToLongBits(getN()) + != java.lang.Double.doubleToLongBits( + other.getN())) 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) + DF_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getDf())); + hash = (37 * hash) + N_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getN())); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.IDFTransformerProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.IDFTransformerProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.IDFTransformerProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.IDFTransformerProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.IDFTransformerProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.IDFTransformerProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.IDFTransformerProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.IDFTransformerProto 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 org.tribuo.protos.core.IDFTransformerProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.IDFTransformerProto 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 org.tribuo.protos.core.IDFTransformerProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.IDFTransformerProto 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(org.tribuo.protos.core.IDFTransformerProto 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; + } + /** + *
+   *IDFTransformer proto
+   * 
+ * + * Protobuf type {@code tribuo.core.IDFTransformerProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.IDFTransformerProto) + org.tribuo.protos.core.IDFTransformerProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_IDFTransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_IDFTransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.IDFTransformerProto.class, org.tribuo.protos.core.IDFTransformerProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.IDFTransformerProto.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(); + df_ = 0D; + + n_ = 0D; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_IDFTransformerProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.IDFTransformerProto getDefaultInstanceForType() { + return org.tribuo.protos.core.IDFTransformerProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.IDFTransformerProto build() { + org.tribuo.protos.core.IDFTransformerProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.IDFTransformerProto buildPartial() { + org.tribuo.protos.core.IDFTransformerProto result = new org.tribuo.protos.core.IDFTransformerProto(this); + result.df_ = df_; + result.n_ = n_; + 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 org.tribuo.protos.core.IDFTransformerProto) { + return mergeFrom((org.tribuo.protos.core.IDFTransformerProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.IDFTransformerProto other) { + if (other == org.tribuo.protos.core.IDFTransformerProto.getDefaultInstance()) return this; + if (other.getDf() != 0D) { + setDf(other.getDf()); + } + if (other.getN() != 0D) { + setN(other.getN()); + } + 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 { + org.tribuo.protos.core.IDFTransformerProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.IDFTransformerProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private double df_ ; + /** + * double df = 1; + * @return The df. + */ + @java.lang.Override + public double getDf() { + return df_; + } + /** + * double df = 1; + * @param value The df to set. + * @return This builder for chaining. + */ + public Builder setDf(double value) { + + df_ = value; + onChanged(); + return this; + } + /** + * double df = 1; + * @return This builder for chaining. + */ + public Builder clearDf() { + + df_ = 0D; + onChanged(); + return this; + } + + private double n_ ; + /** + * double N = 2; + * @return The n. + */ + @java.lang.Override + public double getN() { + return n_; + } + /** + * double N = 2; + * @param value The n to set. + * @return This builder for chaining. + */ + public Builder setN(double value) { + + n_ = value; + onChanged(); + return this; + } + /** + * double N = 2; + * @return This builder for chaining. + */ + public Builder clearN() { + + n_ = 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:tribuo.core.IDFTransformerProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.IDFTransformerProto) + private static final org.tribuo.protos.core.IDFTransformerProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.IDFTransformerProto(); + } + + public static org.tribuo.protos.core.IDFTransformerProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public IDFTransformerProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new IDFTransformerProto(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 org.tribuo.protos.core.IDFTransformerProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/IDFTransformerProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/IDFTransformerProtoOrBuilder.java new file mode 100644 index 000000000..35eaee042 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/IDFTransformerProtoOrBuilder.java @@ -0,0 +1,21 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface IDFTransformerProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.IDFTransformerProto) + com.google.protobuf.MessageOrBuilder { + + /** + * double df = 1; + * @return The df. + */ + double getDf(); + + /** + * double N = 2; + * @return The n. + */ + double getN(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/ImmutableFeatureMapProto.java b/Core/src/main/java/org/tribuo/protos/core/ImmutableFeatureMapProto.java new file mode 100644 index 000000000..65a42728d --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/ImmutableFeatureMapProto.java @@ -0,0 +1,780 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *ImmutableFeatureMap proto
+ * 
+ * + * Protobuf type {@code tribuo.core.ImmutableFeatureMapProto} + */ +public final class ImmutableFeatureMapProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.ImmutableFeatureMapProto) + ImmutableFeatureMapProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use ImmutableFeatureMapProto.newBuilder() to construct. + private ImmutableFeatureMapProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ImmutableFeatureMapProto() { + info_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ImmutableFeatureMapProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ImmutableFeatureMapProto( + 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)) { + info_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + info_.add( + input.readMessage(org.tribuo.protos.core.VariableInfoProto.parser(), extensionRegistry)); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + info_ = java.util.Collections.unmodifiableList(info_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_ImmutableFeatureMapProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_ImmutableFeatureMapProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.ImmutableFeatureMapProto.class, org.tribuo.protos.core.ImmutableFeatureMapProto.Builder.class); + } + + public static final int INFO_FIELD_NUMBER = 1; + private java.util.List info_; + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + @java.lang.Override + public java.util.List getInfoList() { + return info_; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + @java.lang.Override + public java.util.List + getInfoOrBuilderList() { + return info_; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + @java.lang.Override + public int getInfoCount() { + return info_.size(); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + @java.lang.Override + public org.tribuo.protos.core.VariableInfoProto getInfo(int index) { + return info_.get(index); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + @java.lang.Override + public org.tribuo.protos.core.VariableInfoProtoOrBuilder getInfoOrBuilder( + int index) { + return info_.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 < info_.size(); i++) { + output.writeMessage(1, info_.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 < info_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, info_.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 org.tribuo.protos.core.ImmutableFeatureMapProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.ImmutableFeatureMapProto other = (org.tribuo.protos.core.ImmutableFeatureMapProto) obj; + + if (!getInfoList() + .equals(other.getInfoList())) 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 (getInfoCount() > 0) { + hash = (37 * hash) + INFO_FIELD_NUMBER; + hash = (53 * hash) + getInfoList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.ImmutableFeatureMapProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ImmutableFeatureMapProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ImmutableFeatureMapProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ImmutableFeatureMapProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ImmutableFeatureMapProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ImmutableFeatureMapProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ImmutableFeatureMapProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ImmutableFeatureMapProto 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 org.tribuo.protos.core.ImmutableFeatureMapProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ImmutableFeatureMapProto 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 org.tribuo.protos.core.ImmutableFeatureMapProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ImmutableFeatureMapProto 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(org.tribuo.protos.core.ImmutableFeatureMapProto 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; + } + /** + *
+   *ImmutableFeatureMap proto
+   * 
+ * + * Protobuf type {@code tribuo.core.ImmutableFeatureMapProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.ImmutableFeatureMapProto) + org.tribuo.protos.core.ImmutableFeatureMapProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_ImmutableFeatureMapProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_ImmutableFeatureMapProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.ImmutableFeatureMapProto.class, org.tribuo.protos.core.ImmutableFeatureMapProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.ImmutableFeatureMapProto.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getInfoFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (infoBuilder_ == null) { + info_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + infoBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_ImmutableFeatureMapProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.ImmutableFeatureMapProto getDefaultInstanceForType() { + return org.tribuo.protos.core.ImmutableFeatureMapProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.ImmutableFeatureMapProto build() { + org.tribuo.protos.core.ImmutableFeatureMapProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.ImmutableFeatureMapProto buildPartial() { + org.tribuo.protos.core.ImmutableFeatureMapProto result = new org.tribuo.protos.core.ImmutableFeatureMapProto(this); + int from_bitField0_ = bitField0_; + if (infoBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + info_ = java.util.Collections.unmodifiableList(info_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.info_ = info_; + } else { + result.info_ = infoBuilder_.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 org.tribuo.protos.core.ImmutableFeatureMapProto) { + return mergeFrom((org.tribuo.protos.core.ImmutableFeatureMapProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.ImmutableFeatureMapProto other) { + if (other == org.tribuo.protos.core.ImmutableFeatureMapProto.getDefaultInstance()) return this; + if (infoBuilder_ == null) { + if (!other.info_.isEmpty()) { + if (info_.isEmpty()) { + info_ = other.info_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureInfoIsMutable(); + info_.addAll(other.info_); + } + onChanged(); + } + } else { + if (!other.info_.isEmpty()) { + if (infoBuilder_.isEmpty()) { + infoBuilder_.dispose(); + infoBuilder_ = null; + info_ = other.info_; + bitField0_ = (bitField0_ & ~0x00000001); + infoBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getInfoFieldBuilder() : null; + } else { + infoBuilder_.addAllMessages(other.info_); + } + } + } + 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 { + org.tribuo.protos.core.ImmutableFeatureMapProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.ImmutableFeatureMapProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List info_ = + java.util.Collections.emptyList(); + private void ensureInfoIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + info_ = new java.util.ArrayList(info_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.VariableInfoProto, org.tribuo.protos.core.VariableInfoProto.Builder, org.tribuo.protos.core.VariableInfoProtoOrBuilder> infoBuilder_; + + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public java.util.List getInfoList() { + if (infoBuilder_ == null) { + return java.util.Collections.unmodifiableList(info_); + } else { + return infoBuilder_.getMessageList(); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public int getInfoCount() { + if (infoBuilder_ == null) { + return info_.size(); + } else { + return infoBuilder_.getCount(); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public org.tribuo.protos.core.VariableInfoProto getInfo(int index) { + if (infoBuilder_ == null) { + return info_.get(index); + } else { + return infoBuilder_.getMessage(index); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public Builder setInfo( + int index, org.tribuo.protos.core.VariableInfoProto value) { + if (infoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInfoIsMutable(); + info_.set(index, value); + onChanged(); + } else { + infoBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public Builder setInfo( + int index, org.tribuo.protos.core.VariableInfoProto.Builder builderForValue) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.set(index, builderForValue.build()); + onChanged(); + } else { + infoBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public Builder addInfo(org.tribuo.protos.core.VariableInfoProto value) { + if (infoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInfoIsMutable(); + info_.add(value); + onChanged(); + } else { + infoBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public Builder addInfo( + int index, org.tribuo.protos.core.VariableInfoProto value) { + if (infoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInfoIsMutable(); + info_.add(index, value); + onChanged(); + } else { + infoBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public Builder addInfo( + org.tribuo.protos.core.VariableInfoProto.Builder builderForValue) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.add(builderForValue.build()); + onChanged(); + } else { + infoBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public Builder addInfo( + int index, org.tribuo.protos.core.VariableInfoProto.Builder builderForValue) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.add(index, builderForValue.build()); + onChanged(); + } else { + infoBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public Builder addAllInfo( + java.lang.Iterable values) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, info_); + onChanged(); + } else { + infoBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public Builder clearInfo() { + if (infoBuilder_ == null) { + info_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + infoBuilder_.clear(); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public Builder removeInfo(int index) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.remove(index); + onChanged(); + } else { + infoBuilder_.remove(index); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public org.tribuo.protos.core.VariableInfoProto.Builder getInfoBuilder( + int index) { + return getInfoFieldBuilder().getBuilder(index); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public org.tribuo.protos.core.VariableInfoProtoOrBuilder getInfoOrBuilder( + int index) { + if (infoBuilder_ == null) { + return info_.get(index); } else { + return infoBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public java.util.List + getInfoOrBuilderList() { + if (infoBuilder_ != null) { + return infoBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(info_); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public org.tribuo.protos.core.VariableInfoProto.Builder addInfoBuilder() { + return getInfoFieldBuilder().addBuilder( + org.tribuo.protos.core.VariableInfoProto.getDefaultInstance()); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public org.tribuo.protos.core.VariableInfoProto.Builder addInfoBuilder( + int index) { + return getInfoFieldBuilder().addBuilder( + index, org.tribuo.protos.core.VariableInfoProto.getDefaultInstance()); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + public java.util.List + getInfoBuilderList() { + return getInfoFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.VariableInfoProto, org.tribuo.protos.core.VariableInfoProto.Builder, org.tribuo.protos.core.VariableInfoProtoOrBuilder> + getInfoFieldBuilder() { + if (infoBuilder_ == null) { + infoBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.VariableInfoProto, org.tribuo.protos.core.VariableInfoProto.Builder, org.tribuo.protos.core.VariableInfoProtoOrBuilder>( + info_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + info_ = null; + } + return infoBuilder_; + } + @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:tribuo.core.ImmutableFeatureMapProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.ImmutableFeatureMapProto) + private static final org.tribuo.protos.core.ImmutableFeatureMapProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.ImmutableFeatureMapProto(); + } + + public static org.tribuo.protos.core.ImmutableFeatureMapProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ImmutableFeatureMapProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ImmutableFeatureMapProto(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 org.tribuo.protos.core.ImmutableFeatureMapProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/ImmutableFeatureMapProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/ImmutableFeatureMapProtoOrBuilder.java new file mode 100644 index 000000000..b6292b290 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/ImmutableFeatureMapProtoOrBuilder.java @@ -0,0 +1,33 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface ImmutableFeatureMapProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.ImmutableFeatureMapProto) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + java.util.List + getInfoList(); + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + org.tribuo.protos.core.VariableInfoProto getInfo(int index); + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + int getInfoCount(); + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + java.util.List + getInfoOrBuilderList(); + /** + * repeated .tribuo.core.VariableInfoProto info = 1; + */ + org.tribuo.protos.core.VariableInfoProtoOrBuilder getInfoOrBuilder( + int index); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/LinearScalingTransformerProto.java b/Core/src/main/java/org/tribuo/protos/core/LinearScalingTransformerProto.java new file mode 100644 index 000000000..700408031 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/LinearScalingTransformerProto.java @@ -0,0 +1,693 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *LinearScalingTransformer proto
+ * 
+ * + * Protobuf type {@code tribuo.core.LinearScalingTransformerProto} + */ +public final class LinearScalingTransformerProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.LinearScalingTransformerProto) + LinearScalingTransformerProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use LinearScalingTransformerProto.newBuilder() to construct. + private LinearScalingTransformerProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private LinearScalingTransformerProto() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new LinearScalingTransformerProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private LinearScalingTransformerProto( + 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 9: { + + observedMin_ = input.readDouble(); + break; + } + case 17: { + + observedMax_ = input.readDouble(); + break; + } + case 25: { + + targetMin_ = input.readDouble(); + break; + } + case 33: { + + targetMax_ = input.readDouble(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_LinearScalingTransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_LinearScalingTransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.LinearScalingTransformerProto.class, org.tribuo.protos.core.LinearScalingTransformerProto.Builder.class); + } + + public static final int OBSERVEDMIN_FIELD_NUMBER = 1; + private double observedMin_; + /** + * double observedMin = 1; + * @return The observedMin. + */ + @java.lang.Override + public double getObservedMin() { + return observedMin_; + } + + public static final int OBSERVEDMAX_FIELD_NUMBER = 2; + private double observedMax_; + /** + * double observedMax = 2; + * @return The observedMax. + */ + @java.lang.Override + public double getObservedMax() { + return observedMax_; + } + + public static final int TARGETMIN_FIELD_NUMBER = 3; + private double targetMin_; + /** + * double targetMin = 3; + * @return The targetMin. + */ + @java.lang.Override + public double getTargetMin() { + return targetMin_; + } + + public static final int TARGETMAX_FIELD_NUMBER = 4; + private double targetMax_; + /** + * double targetMax = 4; + * @return The targetMax. + */ + @java.lang.Override + public double getTargetMax() { + return targetMax_; + } + + 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 (java.lang.Double.doubleToRawLongBits(observedMin_) != 0) { + output.writeDouble(1, observedMin_); + } + if (java.lang.Double.doubleToRawLongBits(observedMax_) != 0) { + output.writeDouble(2, observedMax_); + } + if (java.lang.Double.doubleToRawLongBits(targetMin_) != 0) { + output.writeDouble(3, targetMin_); + } + if (java.lang.Double.doubleToRawLongBits(targetMax_) != 0) { + output.writeDouble(4, targetMax_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (java.lang.Double.doubleToRawLongBits(observedMin_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(1, observedMin_); + } + if (java.lang.Double.doubleToRawLongBits(observedMax_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(2, observedMax_); + } + if (java.lang.Double.doubleToRawLongBits(targetMin_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(3, targetMin_); + } + if (java.lang.Double.doubleToRawLongBits(targetMax_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(4, targetMax_); + } + 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 org.tribuo.protos.core.LinearScalingTransformerProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.LinearScalingTransformerProto other = (org.tribuo.protos.core.LinearScalingTransformerProto) obj; + + if (java.lang.Double.doubleToLongBits(getObservedMin()) + != java.lang.Double.doubleToLongBits( + other.getObservedMin())) return false; + if (java.lang.Double.doubleToLongBits(getObservedMax()) + != java.lang.Double.doubleToLongBits( + other.getObservedMax())) return false; + if (java.lang.Double.doubleToLongBits(getTargetMin()) + != java.lang.Double.doubleToLongBits( + other.getTargetMin())) return false; + if (java.lang.Double.doubleToLongBits(getTargetMax()) + != java.lang.Double.doubleToLongBits( + other.getTargetMax())) 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) + OBSERVEDMIN_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getObservedMin())); + hash = (37 * hash) + OBSERVEDMAX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getObservedMax())); + hash = (37 * hash) + TARGETMIN_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getTargetMin())); + hash = (37 * hash) + TARGETMAX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getTargetMax())); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.LinearScalingTransformerProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.LinearScalingTransformerProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.LinearScalingTransformerProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.LinearScalingTransformerProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.LinearScalingTransformerProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.LinearScalingTransformerProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.LinearScalingTransformerProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.LinearScalingTransformerProto 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 org.tribuo.protos.core.LinearScalingTransformerProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.LinearScalingTransformerProto 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 org.tribuo.protos.core.LinearScalingTransformerProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.LinearScalingTransformerProto 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(org.tribuo.protos.core.LinearScalingTransformerProto 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; + } + /** + *
+   *LinearScalingTransformer proto
+   * 
+ * + * Protobuf type {@code tribuo.core.LinearScalingTransformerProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.LinearScalingTransformerProto) + org.tribuo.protos.core.LinearScalingTransformerProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_LinearScalingTransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_LinearScalingTransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.LinearScalingTransformerProto.class, org.tribuo.protos.core.LinearScalingTransformerProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.LinearScalingTransformerProto.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(); + observedMin_ = 0D; + + observedMax_ = 0D; + + targetMin_ = 0D; + + targetMax_ = 0D; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_LinearScalingTransformerProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.LinearScalingTransformerProto getDefaultInstanceForType() { + return org.tribuo.protos.core.LinearScalingTransformerProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.LinearScalingTransformerProto build() { + org.tribuo.protos.core.LinearScalingTransformerProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.LinearScalingTransformerProto buildPartial() { + org.tribuo.protos.core.LinearScalingTransformerProto result = new org.tribuo.protos.core.LinearScalingTransformerProto(this); + result.observedMin_ = observedMin_; + result.observedMax_ = observedMax_; + result.targetMin_ = targetMin_; + result.targetMax_ = targetMax_; + 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 org.tribuo.protos.core.LinearScalingTransformerProto) { + return mergeFrom((org.tribuo.protos.core.LinearScalingTransformerProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.LinearScalingTransformerProto other) { + if (other == org.tribuo.protos.core.LinearScalingTransformerProto.getDefaultInstance()) return this; + if (other.getObservedMin() != 0D) { + setObservedMin(other.getObservedMin()); + } + if (other.getObservedMax() != 0D) { + setObservedMax(other.getObservedMax()); + } + if (other.getTargetMin() != 0D) { + setTargetMin(other.getTargetMin()); + } + if (other.getTargetMax() != 0D) { + setTargetMax(other.getTargetMax()); + } + 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 { + org.tribuo.protos.core.LinearScalingTransformerProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.LinearScalingTransformerProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private double observedMin_ ; + /** + * double observedMin = 1; + * @return The observedMin. + */ + @java.lang.Override + public double getObservedMin() { + return observedMin_; + } + /** + * double observedMin = 1; + * @param value The observedMin to set. + * @return This builder for chaining. + */ + public Builder setObservedMin(double value) { + + observedMin_ = value; + onChanged(); + return this; + } + /** + * double observedMin = 1; + * @return This builder for chaining. + */ + public Builder clearObservedMin() { + + observedMin_ = 0D; + onChanged(); + return this; + } + + private double observedMax_ ; + /** + * double observedMax = 2; + * @return The observedMax. + */ + @java.lang.Override + public double getObservedMax() { + return observedMax_; + } + /** + * double observedMax = 2; + * @param value The observedMax to set. + * @return This builder for chaining. + */ + public Builder setObservedMax(double value) { + + observedMax_ = value; + onChanged(); + return this; + } + /** + * double observedMax = 2; + * @return This builder for chaining. + */ + public Builder clearObservedMax() { + + observedMax_ = 0D; + onChanged(); + return this; + } + + private double targetMin_ ; + /** + * double targetMin = 3; + * @return The targetMin. + */ + @java.lang.Override + public double getTargetMin() { + return targetMin_; + } + /** + * double targetMin = 3; + * @param value The targetMin to set. + * @return This builder for chaining. + */ + public Builder setTargetMin(double value) { + + targetMin_ = value; + onChanged(); + return this; + } + /** + * double targetMin = 3; + * @return This builder for chaining. + */ + public Builder clearTargetMin() { + + targetMin_ = 0D; + onChanged(); + return this; + } + + private double targetMax_ ; + /** + * double targetMax = 4; + * @return The targetMax. + */ + @java.lang.Override + public double getTargetMax() { + return targetMax_; + } + /** + * double targetMax = 4; + * @param value The targetMax to set. + * @return This builder for chaining. + */ + public Builder setTargetMax(double value) { + + targetMax_ = value; + onChanged(); + return this; + } + /** + * double targetMax = 4; + * @return This builder for chaining. + */ + public Builder clearTargetMax() { + + targetMax_ = 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:tribuo.core.LinearScalingTransformerProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.LinearScalingTransformerProto) + private static final org.tribuo.protos.core.LinearScalingTransformerProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.LinearScalingTransformerProto(); + } + + public static org.tribuo.protos.core.LinearScalingTransformerProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LinearScalingTransformerProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LinearScalingTransformerProto(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 org.tribuo.protos.core.LinearScalingTransformerProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/LinearScalingTransformerProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/LinearScalingTransformerProtoOrBuilder.java new file mode 100644 index 000000000..4684927d6 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/LinearScalingTransformerProtoOrBuilder.java @@ -0,0 +1,33 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface LinearScalingTransformerProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.LinearScalingTransformerProto) + com.google.protobuf.MessageOrBuilder { + + /** + * double observedMin = 1; + * @return The observedMin. + */ + double getObservedMin(); + + /** + * double observedMax = 2; + * @return The observedMax. + */ + double getObservedMax(); + + /** + * double targetMin = 3; + * @return The targetMin. + */ + double getTargetMin(); + + /** + * double targetMax = 4; + * @return The targetMax. + */ + double getTargetMax(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/MeanStdDevTransformerProto.java b/Core/src/main/java/org/tribuo/protos/core/MeanStdDevTransformerProto.java new file mode 100644 index 000000000..5e8fcaded --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/MeanStdDevTransformerProto.java @@ -0,0 +1,693 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *MeanStdDevTransformer proto
+ * 
+ * + * Protobuf type {@code tribuo.core.MeanStdDevTransformerProto} + */ +public final class MeanStdDevTransformerProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.MeanStdDevTransformerProto) + MeanStdDevTransformerProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use MeanStdDevTransformerProto.newBuilder() to construct. + private MeanStdDevTransformerProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private MeanStdDevTransformerProto() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new MeanStdDevTransformerProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private MeanStdDevTransformerProto( + 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 9: { + + observedMean_ = input.readDouble(); + break; + } + case 17: { + + observedStdDev_ = input.readDouble(); + break; + } + case 25: { + + targetMean_ = input.readDouble(); + break; + } + case 33: { + + targetStdDev_ = input.readDouble(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MeanStdDevTransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MeanStdDevTransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.MeanStdDevTransformerProto.class, org.tribuo.protos.core.MeanStdDevTransformerProto.Builder.class); + } + + public static final int OBSERVEDMEAN_FIELD_NUMBER = 1; + private double observedMean_; + /** + * double observedMean = 1; + * @return The observedMean. + */ + @java.lang.Override + public double getObservedMean() { + return observedMean_; + } + + public static final int OBSERVEDSTDDEV_FIELD_NUMBER = 2; + private double observedStdDev_; + /** + * double observedStdDev = 2; + * @return The observedStdDev. + */ + @java.lang.Override + public double getObservedStdDev() { + return observedStdDev_; + } + + public static final int TARGETMEAN_FIELD_NUMBER = 3; + private double targetMean_; + /** + * double targetMean = 3; + * @return The targetMean. + */ + @java.lang.Override + public double getTargetMean() { + return targetMean_; + } + + public static final int TARGETSTDDEV_FIELD_NUMBER = 4; + private double targetStdDev_; + /** + * double targetStdDev = 4; + * @return The targetStdDev. + */ + @java.lang.Override + public double getTargetStdDev() { + return targetStdDev_; + } + + 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 (java.lang.Double.doubleToRawLongBits(observedMean_) != 0) { + output.writeDouble(1, observedMean_); + } + if (java.lang.Double.doubleToRawLongBits(observedStdDev_) != 0) { + output.writeDouble(2, observedStdDev_); + } + if (java.lang.Double.doubleToRawLongBits(targetMean_) != 0) { + output.writeDouble(3, targetMean_); + } + if (java.lang.Double.doubleToRawLongBits(targetStdDev_) != 0) { + output.writeDouble(4, targetStdDev_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (java.lang.Double.doubleToRawLongBits(observedMean_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(1, observedMean_); + } + if (java.lang.Double.doubleToRawLongBits(observedStdDev_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(2, observedStdDev_); + } + if (java.lang.Double.doubleToRawLongBits(targetMean_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(3, targetMean_); + } + if (java.lang.Double.doubleToRawLongBits(targetStdDev_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(4, targetStdDev_); + } + 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 org.tribuo.protos.core.MeanStdDevTransformerProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.MeanStdDevTransformerProto other = (org.tribuo.protos.core.MeanStdDevTransformerProto) obj; + + if (java.lang.Double.doubleToLongBits(getObservedMean()) + != java.lang.Double.doubleToLongBits( + other.getObservedMean())) return false; + if (java.lang.Double.doubleToLongBits(getObservedStdDev()) + != java.lang.Double.doubleToLongBits( + other.getObservedStdDev())) return false; + if (java.lang.Double.doubleToLongBits(getTargetMean()) + != java.lang.Double.doubleToLongBits( + other.getTargetMean())) return false; + if (java.lang.Double.doubleToLongBits(getTargetStdDev()) + != java.lang.Double.doubleToLongBits( + other.getTargetStdDev())) 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) + OBSERVEDMEAN_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getObservedMean())); + hash = (37 * hash) + OBSERVEDSTDDEV_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getObservedStdDev())); + hash = (37 * hash) + TARGETMEAN_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getTargetMean())); + hash = (37 * hash) + TARGETSTDDEV_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getTargetStdDev())); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.MeanStdDevTransformerProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MeanStdDevTransformerProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MeanStdDevTransformerProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MeanStdDevTransformerProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MeanStdDevTransformerProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MeanStdDevTransformerProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MeanStdDevTransformerProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MeanStdDevTransformerProto 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 org.tribuo.protos.core.MeanStdDevTransformerProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MeanStdDevTransformerProto 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 org.tribuo.protos.core.MeanStdDevTransformerProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MeanStdDevTransformerProto 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(org.tribuo.protos.core.MeanStdDevTransformerProto 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; + } + /** + *
+   *MeanStdDevTransformer proto
+   * 
+ * + * Protobuf type {@code tribuo.core.MeanStdDevTransformerProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.MeanStdDevTransformerProto) + org.tribuo.protos.core.MeanStdDevTransformerProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MeanStdDevTransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MeanStdDevTransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.MeanStdDevTransformerProto.class, org.tribuo.protos.core.MeanStdDevTransformerProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.MeanStdDevTransformerProto.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(); + observedMean_ = 0D; + + observedStdDev_ = 0D; + + targetMean_ = 0D; + + targetStdDev_ = 0D; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MeanStdDevTransformerProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.MeanStdDevTransformerProto getDefaultInstanceForType() { + return org.tribuo.protos.core.MeanStdDevTransformerProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.MeanStdDevTransformerProto build() { + org.tribuo.protos.core.MeanStdDevTransformerProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.MeanStdDevTransformerProto buildPartial() { + org.tribuo.protos.core.MeanStdDevTransformerProto result = new org.tribuo.protos.core.MeanStdDevTransformerProto(this); + result.observedMean_ = observedMean_; + result.observedStdDev_ = observedStdDev_; + result.targetMean_ = targetMean_; + result.targetStdDev_ = targetStdDev_; + 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 org.tribuo.protos.core.MeanStdDevTransformerProto) { + return mergeFrom((org.tribuo.protos.core.MeanStdDevTransformerProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.MeanStdDevTransformerProto other) { + if (other == org.tribuo.protos.core.MeanStdDevTransformerProto.getDefaultInstance()) return this; + if (other.getObservedMean() != 0D) { + setObservedMean(other.getObservedMean()); + } + if (other.getObservedStdDev() != 0D) { + setObservedStdDev(other.getObservedStdDev()); + } + if (other.getTargetMean() != 0D) { + setTargetMean(other.getTargetMean()); + } + if (other.getTargetStdDev() != 0D) { + setTargetStdDev(other.getTargetStdDev()); + } + 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 { + org.tribuo.protos.core.MeanStdDevTransformerProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.MeanStdDevTransformerProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private double observedMean_ ; + /** + * double observedMean = 1; + * @return The observedMean. + */ + @java.lang.Override + public double getObservedMean() { + return observedMean_; + } + /** + * double observedMean = 1; + * @param value The observedMean to set. + * @return This builder for chaining. + */ + public Builder setObservedMean(double value) { + + observedMean_ = value; + onChanged(); + return this; + } + /** + * double observedMean = 1; + * @return This builder for chaining. + */ + public Builder clearObservedMean() { + + observedMean_ = 0D; + onChanged(); + return this; + } + + private double observedStdDev_ ; + /** + * double observedStdDev = 2; + * @return The observedStdDev. + */ + @java.lang.Override + public double getObservedStdDev() { + return observedStdDev_; + } + /** + * double observedStdDev = 2; + * @param value The observedStdDev to set. + * @return This builder for chaining. + */ + public Builder setObservedStdDev(double value) { + + observedStdDev_ = value; + onChanged(); + return this; + } + /** + * double observedStdDev = 2; + * @return This builder for chaining. + */ + public Builder clearObservedStdDev() { + + observedStdDev_ = 0D; + onChanged(); + return this; + } + + private double targetMean_ ; + /** + * double targetMean = 3; + * @return The targetMean. + */ + @java.lang.Override + public double getTargetMean() { + return targetMean_; + } + /** + * double targetMean = 3; + * @param value The targetMean to set. + * @return This builder for chaining. + */ + public Builder setTargetMean(double value) { + + targetMean_ = value; + onChanged(); + return this; + } + /** + * double targetMean = 3; + * @return This builder for chaining. + */ + public Builder clearTargetMean() { + + targetMean_ = 0D; + onChanged(); + return this; + } + + private double targetStdDev_ ; + /** + * double targetStdDev = 4; + * @return The targetStdDev. + */ + @java.lang.Override + public double getTargetStdDev() { + return targetStdDev_; + } + /** + * double targetStdDev = 4; + * @param value The targetStdDev to set. + * @return This builder for chaining. + */ + public Builder setTargetStdDev(double value) { + + targetStdDev_ = value; + onChanged(); + return this; + } + /** + * double targetStdDev = 4; + * @return This builder for chaining. + */ + public Builder clearTargetStdDev() { + + targetStdDev_ = 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:tribuo.core.MeanStdDevTransformerProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.MeanStdDevTransformerProto) + private static final org.tribuo.protos.core.MeanStdDevTransformerProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.MeanStdDevTransformerProto(); + } + + public static org.tribuo.protos.core.MeanStdDevTransformerProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MeanStdDevTransformerProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new MeanStdDevTransformerProto(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 org.tribuo.protos.core.MeanStdDevTransformerProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/MeanStdDevTransformerProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/MeanStdDevTransformerProtoOrBuilder.java new file mode 100644 index 000000000..b60cea507 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/MeanStdDevTransformerProtoOrBuilder.java @@ -0,0 +1,33 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface MeanStdDevTransformerProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.MeanStdDevTransformerProto) + com.google.protobuf.MessageOrBuilder { + + /** + * double observedMean = 1; + * @return The observedMean. + */ + double getObservedMean(); + + /** + * double observedStdDev = 2; + * @return The observedStdDev. + */ + double getObservedStdDev(); + + /** + * double targetMean = 3; + * @return The targetMean. + */ + double getTargetMean(); + + /** + * double targetStdDev = 4; + * @return The targetStdDev. + */ + double getTargetStdDev(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/MeanVarianceProto.java b/Core/src/main/java/org/tribuo/protos/core/MeanVarianceProto.java new file mode 100644 index 000000000..6e2e5ae1e --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/MeanVarianceProto.java @@ -0,0 +1,822 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Mean variance accumulator proto
+ * 
+ * + * Protobuf type {@code tribuo.core.MeanVarianceProto} + */ +public final class MeanVarianceProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.MeanVarianceProto) + MeanVarianceProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use MeanVarianceProto.newBuilder() to construct. + private MeanVarianceProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private MeanVarianceProto() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new MeanVarianceProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private MeanVarianceProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 17: { + + max_ = input.readDouble(); + break; + } + case 25: { + + min_ = input.readDouble(); + break; + } + case 33: { + + mean_ = input.readDouble(); + break; + } + case 41: { + + sumSquares_ = input.readDouble(); + break; + } + case 48: { + + count_ = input.readInt64(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_MeanVarianceProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_MeanVarianceProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.MeanVarianceProto.class, org.tribuo.protos.core.MeanVarianceProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int MAX_FIELD_NUMBER = 2; + private double max_; + /** + * double max = 2; + * @return The max. + */ + @java.lang.Override + public double getMax() { + return max_; + } + + public static final int MIN_FIELD_NUMBER = 3; + private double min_; + /** + * double min = 3; + * @return The min. + */ + @java.lang.Override + public double getMin() { + return min_; + } + + public static final int MEAN_FIELD_NUMBER = 4; + private double mean_; + /** + * double mean = 4; + * @return The mean. + */ + @java.lang.Override + public double getMean() { + return mean_; + } + + public static final int SUMSQUARES_FIELD_NUMBER = 5; + private double sumSquares_; + /** + * double sumSquares = 5; + * @return The sumSquares. + */ + @java.lang.Override + public double getSumSquares() { + return sumSquares_; + } + + public static final int COUNT_FIELD_NUMBER = 6; + private long count_; + /** + * int64 count = 6; + * @return The count. + */ + @java.lang.Override + public long getCount() { + return count_; + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (java.lang.Double.doubleToRawLongBits(max_) != 0) { + output.writeDouble(2, max_); + } + if (java.lang.Double.doubleToRawLongBits(min_) != 0) { + output.writeDouble(3, min_); + } + if (java.lang.Double.doubleToRawLongBits(mean_) != 0) { + output.writeDouble(4, mean_); + } + if (java.lang.Double.doubleToRawLongBits(sumSquares_) != 0) { + output.writeDouble(5, sumSquares_); + } + if (count_ != 0L) { + output.writeInt64(6, count_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (java.lang.Double.doubleToRawLongBits(max_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(2, max_); + } + if (java.lang.Double.doubleToRawLongBits(min_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(3, min_); + } + if (java.lang.Double.doubleToRawLongBits(mean_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(4, mean_); + } + if (java.lang.Double.doubleToRawLongBits(sumSquares_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(5, sumSquares_); + } + if (count_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(6, count_); + } + 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 org.tribuo.protos.core.MeanVarianceProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.MeanVarianceProto other = (org.tribuo.protos.core.MeanVarianceProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (java.lang.Double.doubleToLongBits(getMax()) + != java.lang.Double.doubleToLongBits( + other.getMax())) return false; + if (java.lang.Double.doubleToLongBits(getMin()) + != java.lang.Double.doubleToLongBits( + other.getMin())) return false; + if (java.lang.Double.doubleToLongBits(getMean()) + != java.lang.Double.doubleToLongBits( + other.getMean())) return false; + if (java.lang.Double.doubleToLongBits(getSumSquares()) + != java.lang.Double.doubleToLongBits( + other.getSumSquares())) return false; + if (getCount() + != other.getCount()) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + MAX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getMax())); + hash = (37 * hash) + MIN_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getMin())); + hash = (37 * hash) + MEAN_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getMean())); + hash = (37 * hash) + SUMSQUARES_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getSumSquares())); + hash = (37 * hash) + COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getCount()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.MeanVarianceProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MeanVarianceProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MeanVarianceProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MeanVarianceProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MeanVarianceProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MeanVarianceProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MeanVarianceProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MeanVarianceProto 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 org.tribuo.protos.core.MeanVarianceProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MeanVarianceProto 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 org.tribuo.protos.core.MeanVarianceProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MeanVarianceProto 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(org.tribuo.protos.core.MeanVarianceProto 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; + } + /** + *
+   *Mean variance accumulator proto
+   * 
+ * + * Protobuf type {@code tribuo.core.MeanVarianceProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.MeanVarianceProto) + org.tribuo.protos.core.MeanVarianceProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_MeanVarianceProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_MeanVarianceProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.MeanVarianceProto.class, org.tribuo.protos.core.MeanVarianceProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.MeanVarianceProto.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(); + version_ = 0; + + max_ = 0D; + + min_ = 0D; + + mean_ = 0D; + + sumSquares_ = 0D; + + count_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_MeanVarianceProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.MeanVarianceProto getDefaultInstanceForType() { + return org.tribuo.protos.core.MeanVarianceProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.MeanVarianceProto build() { + org.tribuo.protos.core.MeanVarianceProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.MeanVarianceProto buildPartial() { + org.tribuo.protos.core.MeanVarianceProto result = new org.tribuo.protos.core.MeanVarianceProto(this); + result.version_ = version_; + result.max_ = max_; + result.min_ = min_; + result.mean_ = mean_; + result.sumSquares_ = sumSquares_; + result.count_ = count_; + 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 org.tribuo.protos.core.MeanVarianceProto) { + return mergeFrom((org.tribuo.protos.core.MeanVarianceProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.MeanVarianceProto other) { + if (other == org.tribuo.protos.core.MeanVarianceProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (other.getMax() != 0D) { + setMax(other.getMax()); + } + if (other.getMin() != 0D) { + setMin(other.getMin()); + } + if (other.getMean() != 0D) { + setMean(other.getMean()); + } + if (other.getSumSquares() != 0D) { + setSumSquares(other.getSumSquares()); + } + if (other.getCount() != 0L) { + setCount(other.getCount()); + } + 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 { + org.tribuo.protos.core.MeanVarianceProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.MeanVarianceProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private double max_ ; + /** + * double max = 2; + * @return The max. + */ + @java.lang.Override + public double getMax() { + return max_; + } + /** + * double max = 2; + * @param value The max to set. + * @return This builder for chaining. + */ + public Builder setMax(double value) { + + max_ = value; + onChanged(); + return this; + } + /** + * double max = 2; + * @return This builder for chaining. + */ + public Builder clearMax() { + + max_ = 0D; + onChanged(); + return this; + } + + private double min_ ; + /** + * double min = 3; + * @return The min. + */ + @java.lang.Override + public double getMin() { + return min_; + } + /** + * double min = 3; + * @param value The min to set. + * @return This builder for chaining. + */ + public Builder setMin(double value) { + + min_ = value; + onChanged(); + return this; + } + /** + * double min = 3; + * @return This builder for chaining. + */ + public Builder clearMin() { + + min_ = 0D; + onChanged(); + return this; + } + + private double mean_ ; + /** + * double mean = 4; + * @return The mean. + */ + @java.lang.Override + public double getMean() { + return mean_; + } + /** + * double mean = 4; + * @param value The mean to set. + * @return This builder for chaining. + */ + public Builder setMean(double value) { + + mean_ = value; + onChanged(); + return this; + } + /** + * double mean = 4; + * @return This builder for chaining. + */ + public Builder clearMean() { + + mean_ = 0D; + onChanged(); + return this; + } + + private double sumSquares_ ; + /** + * double sumSquares = 5; + * @return The sumSquares. + */ + @java.lang.Override + public double getSumSquares() { + return sumSquares_; + } + /** + * double sumSquares = 5; + * @param value The sumSquares to set. + * @return This builder for chaining. + */ + public Builder setSumSquares(double value) { + + sumSquares_ = value; + onChanged(); + return this; + } + /** + * double sumSquares = 5; + * @return This builder for chaining. + */ + public Builder clearSumSquares() { + + sumSquares_ = 0D; + onChanged(); + return this; + } + + private long count_ ; + /** + * int64 count = 6; + * @return The count. + */ + @java.lang.Override + public long getCount() { + return count_; + } + /** + * int64 count = 6; + * @param value The count to set. + * @return This builder for chaining. + */ + public Builder setCount(long value) { + + count_ = value; + onChanged(); + return this; + } + /** + * int64 count = 6; + * @return This builder for chaining. + */ + public Builder clearCount() { + + count_ = 0L; + 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:tribuo.core.MeanVarianceProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.MeanVarianceProto) + private static final org.tribuo.protos.core.MeanVarianceProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.MeanVarianceProto(); + } + + public static org.tribuo.protos.core.MeanVarianceProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MeanVarianceProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new MeanVarianceProto(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 org.tribuo.protos.core.MeanVarianceProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/MeanVarianceProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/MeanVarianceProtoOrBuilder.java new file mode 100644 index 000000000..f934b2e12 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/MeanVarianceProtoOrBuilder.java @@ -0,0 +1,45 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface MeanVarianceProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.MeanVarianceProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * double max = 2; + * @return The max. + */ + double getMax(); + + /** + * double min = 3; + * @return The min. + */ + double getMin(); + + /** + * double mean = 4; + * @return The mean. + */ + double getMean(); + + /** + * double sumSquares = 5; + * @return The sumSquares. + */ + double getSumSquares(); + + /** + * int64 count = 6; + * @return The count. + */ + long getCount(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/MessageDigestHasherProto.java b/Core/src/main/java/org/tribuo/protos/core/MessageDigestHasherProto.java new file mode 100644 index 000000000..ce4f5757a --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/MessageDigestHasherProto.java @@ -0,0 +1,567 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *MessageDigestHasher proto
+ * 
+ * + * Protobuf type {@code tribuo.core.MessageDigestHasherProto} + */ +public final class MessageDigestHasherProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.MessageDigestHasherProto) + MessageDigestHasherProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use MessageDigestHasherProto.newBuilder() to construct. + private MessageDigestHasherProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private MessageDigestHasherProto() { + hashType_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new MessageDigestHasherProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private MessageDigestHasherProto( + 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 10: { + java.lang.String s = input.readStringRequireUtf8(); + + hashType_ = s; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MessageDigestHasherProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MessageDigestHasherProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.MessageDigestHasherProto.class, org.tribuo.protos.core.MessageDigestHasherProto.Builder.class); + } + + public static final int HASH_TYPE_FIELD_NUMBER = 1; + private volatile java.lang.Object hashType_; + /** + * string hash_type = 1; + * @return The hashType. + */ + @java.lang.Override + public java.lang.String getHashType() { + java.lang.Object ref = hashType_; + 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(); + hashType_ = s; + return s; + } + } + /** + * string hash_type = 1; + * @return The bytes for hashType. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getHashTypeBytes() { + java.lang.Object ref = hashType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + hashType_ = 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(hashType_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, hashType_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(hashType_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, hashType_); + } + 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 org.tribuo.protos.core.MessageDigestHasherProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.MessageDigestHasherProto other = (org.tribuo.protos.core.MessageDigestHasherProto) obj; + + if (!getHashType() + .equals(other.getHashType())) 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) + HASH_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getHashType().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.MessageDigestHasherProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MessageDigestHasherProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MessageDigestHasherProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MessageDigestHasherProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MessageDigestHasherProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MessageDigestHasherProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MessageDigestHasherProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MessageDigestHasherProto 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 org.tribuo.protos.core.MessageDigestHasherProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MessageDigestHasherProto 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 org.tribuo.protos.core.MessageDigestHasherProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MessageDigestHasherProto 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(org.tribuo.protos.core.MessageDigestHasherProto 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; + } + /** + *
+   *MessageDigestHasher proto
+   * 
+ * + * Protobuf type {@code tribuo.core.MessageDigestHasherProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.MessageDigestHasherProto) + org.tribuo.protos.core.MessageDigestHasherProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MessageDigestHasherProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MessageDigestHasherProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.MessageDigestHasherProto.class, org.tribuo.protos.core.MessageDigestHasherProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.MessageDigestHasherProto.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(); + hashType_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MessageDigestHasherProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.MessageDigestHasherProto getDefaultInstanceForType() { + return org.tribuo.protos.core.MessageDigestHasherProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.MessageDigestHasherProto build() { + org.tribuo.protos.core.MessageDigestHasherProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.MessageDigestHasherProto buildPartial() { + org.tribuo.protos.core.MessageDigestHasherProto result = new org.tribuo.protos.core.MessageDigestHasherProto(this); + result.hashType_ = hashType_; + 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 org.tribuo.protos.core.MessageDigestHasherProto) { + return mergeFrom((org.tribuo.protos.core.MessageDigestHasherProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.MessageDigestHasherProto other) { + if (other == org.tribuo.protos.core.MessageDigestHasherProto.getDefaultInstance()) return this; + if (!other.getHashType().isEmpty()) { + hashType_ = other.hashType_; + 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 { + org.tribuo.protos.core.MessageDigestHasherProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.MessageDigestHasherProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object hashType_ = ""; + /** + * string hash_type = 1; + * @return The hashType. + */ + public java.lang.String getHashType() { + java.lang.Object ref = hashType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + hashType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string hash_type = 1; + * @return The bytes for hashType. + */ + public com.google.protobuf.ByteString + getHashTypeBytes() { + java.lang.Object ref = hashType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + hashType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string hash_type = 1; + * @param value The hashType to set. + * @return This builder for chaining. + */ + public Builder setHashType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + hashType_ = value; + onChanged(); + return this; + } + /** + * string hash_type = 1; + * @return This builder for chaining. + */ + public Builder clearHashType() { + + hashType_ = getDefaultInstance().getHashType(); + onChanged(); + return this; + } + /** + * string hash_type = 1; + * @param value The bytes for hashType to set. + * @return This builder for chaining. + */ + public Builder setHashTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + hashType_ = 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:tribuo.core.MessageDigestHasherProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.MessageDigestHasherProto) + private static final org.tribuo.protos.core.MessageDigestHasherProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.MessageDigestHasherProto(); + } + + public static org.tribuo.protos.core.MessageDigestHasherProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MessageDigestHasherProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new MessageDigestHasherProto(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 org.tribuo.protos.core.MessageDigestHasherProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/MessageDigestHasherProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/MessageDigestHasherProtoOrBuilder.java new file mode 100644 index 000000000..50e3ae8fc --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/MessageDigestHasherProtoOrBuilder.java @@ -0,0 +1,21 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface MessageDigestHasherProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.MessageDigestHasherProto) + com.google.protobuf.MessageOrBuilder { + + /** + * string hash_type = 1; + * @return The hashType. + */ + java.lang.String getHashType(); + /** + * string hash_type = 1; + * @return The bytes for hashType. + */ + com.google.protobuf.ByteString + getHashTypeBytes(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/ModHashCodeHasherProto.java b/Core/src/main/java/org/tribuo/protos/core/ModHashCodeHasherProto.java new file mode 100644 index 000000000..4aad39007 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/ModHashCodeHasherProto.java @@ -0,0 +1,493 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *ModHashCodeHasher proto
+ * 
+ * + * Protobuf type {@code tribuo.core.ModHashCodeHasherProto} + */ +public final class ModHashCodeHasherProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.ModHashCodeHasherProto) + ModHashCodeHasherProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use ModHashCodeHasherProto.newBuilder() to construct. + private ModHashCodeHasherProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ModHashCodeHasherProto() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ModHashCodeHasherProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ModHashCodeHasherProto( + 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: { + + dimension_ = input.readInt32(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_ModHashCodeHasherProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_ModHashCodeHasherProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.ModHashCodeHasherProto.class, org.tribuo.protos.core.ModHashCodeHasherProto.Builder.class); + } + + public static final int DIMENSION_FIELD_NUMBER = 1; + private int dimension_; + /** + * int32 dimension = 1; + * @return The dimension. + */ + @java.lang.Override + public int getDimension() { + return dimension_; + } + + 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 (dimension_ != 0) { + output.writeInt32(1, dimension_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (dimension_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, dimension_); + } + 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 org.tribuo.protos.core.ModHashCodeHasherProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.ModHashCodeHasherProto other = (org.tribuo.protos.core.ModHashCodeHasherProto) obj; + + if (getDimension() + != other.getDimension()) 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) + DIMENSION_FIELD_NUMBER; + hash = (53 * hash) + getDimension(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.ModHashCodeHasherProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ModHashCodeHasherProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ModHashCodeHasherProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ModHashCodeHasherProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ModHashCodeHasherProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ModHashCodeHasherProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ModHashCodeHasherProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ModHashCodeHasherProto 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 org.tribuo.protos.core.ModHashCodeHasherProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ModHashCodeHasherProto 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 org.tribuo.protos.core.ModHashCodeHasherProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ModHashCodeHasherProto 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(org.tribuo.protos.core.ModHashCodeHasherProto 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; + } + /** + *
+   *ModHashCodeHasher proto
+   * 
+ * + * Protobuf type {@code tribuo.core.ModHashCodeHasherProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.ModHashCodeHasherProto) + org.tribuo.protos.core.ModHashCodeHasherProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_ModHashCodeHasherProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_ModHashCodeHasherProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.ModHashCodeHasherProto.class, org.tribuo.protos.core.ModHashCodeHasherProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.ModHashCodeHasherProto.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(); + dimension_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_ModHashCodeHasherProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.ModHashCodeHasherProto getDefaultInstanceForType() { + return org.tribuo.protos.core.ModHashCodeHasherProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.ModHashCodeHasherProto build() { + org.tribuo.protos.core.ModHashCodeHasherProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.ModHashCodeHasherProto buildPartial() { + org.tribuo.protos.core.ModHashCodeHasherProto result = new org.tribuo.protos.core.ModHashCodeHasherProto(this); + result.dimension_ = dimension_; + 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 org.tribuo.protos.core.ModHashCodeHasherProto) { + return mergeFrom((org.tribuo.protos.core.ModHashCodeHasherProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.ModHashCodeHasherProto other) { + if (other == org.tribuo.protos.core.ModHashCodeHasherProto.getDefaultInstance()) return this; + if (other.getDimension() != 0) { + setDimension(other.getDimension()); + } + 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 { + org.tribuo.protos.core.ModHashCodeHasherProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.ModHashCodeHasherProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int dimension_ ; + /** + * int32 dimension = 1; + * @return The dimension. + */ + @java.lang.Override + public int getDimension() { + return dimension_; + } + /** + * int32 dimension = 1; + * @param value The dimension to set. + * @return This builder for chaining. + */ + public Builder setDimension(int value) { + + dimension_ = value; + onChanged(); + return this; + } + /** + * int32 dimension = 1; + * @return This builder for chaining. + */ + public Builder clearDimension() { + + dimension_ = 0; + 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:tribuo.core.ModHashCodeHasherProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.ModHashCodeHasherProto) + private static final org.tribuo.protos.core.ModHashCodeHasherProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.ModHashCodeHasherProto(); + } + + public static org.tribuo.protos.core.ModHashCodeHasherProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ModHashCodeHasherProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ModHashCodeHasherProto(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 org.tribuo.protos.core.ModHashCodeHasherProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/ModHashCodeHasherProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/ModHashCodeHasherProtoOrBuilder.java new file mode 100644 index 000000000..3f44c2ea6 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/ModHashCodeHasherProtoOrBuilder.java @@ -0,0 +1,15 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface ModHashCodeHasherProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.ModHashCodeHasherProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 dimension = 1; + * @return The dimension. + */ + int getDimension(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/ModelDataProto.java b/Core/src/main/java/org/tribuo/protos/core/ModelDataProto.java new file mode 100644 index 000000000..b18b6ab95 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/ModelDataProto.java @@ -0,0 +1,819 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Model data redirection proto
+ * 
+ * + * Protobuf type {@code tribuo.core.ModelDataProto} + */ +public final class ModelDataProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.ModelDataProto) + ModelDataProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use ModelDataProto.newBuilder() to construct. + private ModelDataProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ModelDataProto() { + className_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ModelDataProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ModelDataProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + com.google.protobuf.Any.Builder subBuilder = null; + if (serializedData_ != null) { + subBuilder = serializedData_.toBuilder(); + } + serializedData_ = input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(serializedData_); + serializedData_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ModelDataProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ModelDataProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.ModelDataProto.class, org.tribuo.protos.core.ModelDataProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERIALIZED_DATA_FIELD_NUMBER = 3; + private com.google.protobuf.Any serializedData_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + @java.lang.Override + public boolean hasSerializedData() { + return serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + @java.lang.Override + public com.google.protobuf.Any getSerializedData() { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + @java.lang.Override + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + return getSerializedData(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (serializedData_ != null) { + output.writeMessage(3, getSerializedData()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (serializedData_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getSerializedData()); + } + 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 org.tribuo.protos.core.ModelDataProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.ModelDataProto other = (org.tribuo.protos.core.ModelDataProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasSerializedData() != other.hasSerializedData()) return false; + if (hasSerializedData()) { + if (!getSerializedData() + .equals(other.getSerializedData())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasSerializedData()) { + hash = (37 * hash) + SERIALIZED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getSerializedData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.ModelDataProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ModelDataProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ModelDataProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ModelDataProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ModelDataProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ModelDataProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ModelDataProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ModelDataProto 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 org.tribuo.protos.core.ModelDataProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ModelDataProto 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 org.tribuo.protos.core.ModelDataProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ModelDataProto 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(org.tribuo.protos.core.ModelDataProto 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; + } + /** + *
+   *Model data redirection proto
+   * 
+ * + * Protobuf type {@code tribuo.core.ModelDataProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.ModelDataProto) + org.tribuo.protos.core.ModelDataProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ModelDataProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ModelDataProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.ModelDataProto.class, org.tribuo.protos.core.ModelDataProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.ModelDataProto.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(); + version_ = 0; + + className_ = ""; + + if (serializedDataBuilder_ == null) { + serializedData_ = null; + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ModelDataProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.ModelDataProto getDefaultInstanceForType() { + return org.tribuo.protos.core.ModelDataProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.ModelDataProto build() { + org.tribuo.protos.core.ModelDataProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.ModelDataProto buildPartial() { + org.tribuo.protos.core.ModelDataProto result = new org.tribuo.protos.core.ModelDataProto(this); + result.version_ = version_; + result.className_ = className_; + if (serializedDataBuilder_ == null) { + result.serializedData_ = serializedData_; + } else { + result.serializedData_ = serializedDataBuilder_.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 org.tribuo.protos.core.ModelDataProto) { + return mergeFrom((org.tribuo.protos.core.ModelDataProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.ModelDataProto other) { + if (other == org.tribuo.protos.core.ModelDataProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasSerializedData()) { + mergeSerializedData(other.getSerializedData()); + } + 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 { + org.tribuo.protos.core.ModelDataProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.ModelDataProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Any serializedData_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> serializedDataBuilder_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + public boolean hasSerializedData() { + return serializedDataBuilder_ != null || serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + public com.google.protobuf.Any getSerializedData() { + if (serializedDataBuilder_ == null) { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } else { + return serializedDataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + serializedData_ = value; + onChanged(); + } else { + serializedDataBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData( + com.google.protobuf.Any.Builder builderForValue) { + if (serializedDataBuilder_ == null) { + serializedData_ = builderForValue.build(); + onChanged(); + } else { + serializedDataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder mergeSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (serializedData_ != null) { + serializedData_ = + com.google.protobuf.Any.newBuilder(serializedData_).mergeFrom(value).buildPartial(); + } else { + serializedData_ = value; + } + onChanged(); + } else { + serializedDataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder clearSerializedData() { + if (serializedDataBuilder_ == null) { + serializedData_ = null; + onChanged(); + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.Any.Builder getSerializedDataBuilder() { + + onChanged(); + return getSerializedDataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + if (serializedDataBuilder_ != null) { + return serializedDataBuilder_.getMessageOrBuilder(); + } else { + return serializedData_ == null ? + com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> + getSerializedDataFieldBuilder() { + if (serializedDataBuilder_ == null) { + serializedDataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( + getSerializedData(), + getParentForChildren(), + isClean()); + serializedData_ = null; + } + return serializedDataBuilder_; + } + @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:tribuo.core.ModelDataProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.ModelDataProto) + private static final org.tribuo.protos.core.ModelDataProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.ModelDataProto(); + } + + public static org.tribuo.protos.core.ModelDataProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ModelDataProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ModelDataProto(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 org.tribuo.protos.core.ModelDataProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/ModelDataProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/ModelDataProtoOrBuilder.java new file mode 100644 index 000000000..9139803c7 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/ModelDataProtoOrBuilder.java @@ -0,0 +1,42 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface ModelDataProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.ModelDataProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + boolean hasSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + com.google.protobuf.Any getSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + */ + com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/ModelProto.java b/Core/src/main/java/org/tribuo/protos/core/ModelProto.java new file mode 100644 index 000000000..80ff1e572 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/ModelProto.java @@ -0,0 +1,1700 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Base model protobuf. Contains the core model fields, along with an Any containing model specific information.
+ * 
+ * + * Protobuf type {@code tribuo.core.ModelProto} + */ +public final class ModelProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.ModelProto) + ModelProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use ModelProto.newBuilder() to construct. + private ModelProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ModelProto() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ModelProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ModelProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 26: { + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder subBuilder = null; + if (provenance_ != null) { + subBuilder = provenance_.toBuilder(); + } + provenance_ = input.readMessage(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(provenance_); + provenance_ = subBuilder.buildPartial(); + } + + break; + } + case 32: { + + generateProbabilities_ = input.readBool(); + break; + } + case 42: { + org.tribuo.protos.core.FeatureDomainProto.Builder subBuilder = null; + if (featureDomain_ != null) { + subBuilder = featureDomain_.toBuilder(); + } + featureDomain_ = input.readMessage(org.tribuo.protos.core.FeatureDomainProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(featureDomain_); + featureDomain_ = subBuilder.buildPartial(); + } + + break; + } + case 50: { + org.tribuo.protos.core.OutputDomainProto.Builder subBuilder = null; + if (outputDomain_ != null) { + subBuilder = outputDomain_.toBuilder(); + } + outputDomain_ = input.readMessage(org.tribuo.protos.core.OutputDomainProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(outputDomain_); + outputDomain_ = subBuilder.buildPartial(); + } + + break; + } + case 58: { + org.tribuo.protos.core.ModelDataProto.Builder subBuilder = null; + if (modelData_ != null) { + subBuilder = modelData_.toBuilder(); + } + modelData_ = input.readMessage(org.tribuo.protos.core.ModelDataProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(modelData_); + modelData_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ModelProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ModelProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.ModelProto.class, org.tribuo.protos.core.ModelProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + *
+   *Version number of the model proto
+   * 
+ * + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object name_; + /** + *
+   *The model name
+   * 
+ * + * string name = 2; + * @return The name. + */ + @java.lang.Override + 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; + } + } + /** + *
+   *The model name
+   * 
+ * + * string name = 2; + * @return The bytes for name. + */ + @java.lang.Override + 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; + } + } + + public static final int PROVENANCE_FIELD_NUMBER = 3; + private com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto provenance_; + /** + *
+   *The model provenance
+   * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + * @return Whether the provenance field is set. + */ + @java.lang.Override + public boolean hasProvenance() { + return provenance_ != null; + } + /** + *
+   *The model provenance
+   * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + * @return The provenance. + */ + @java.lang.Override + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getProvenance() { + return provenance_ == null ? com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : provenance_; + } + /** + *
+   *The model provenance
+   * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + */ + @java.lang.Override + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getProvenanceOrBuilder() { + return getProvenance(); + } + + public static final int GENERATE_PROBABILITIES_FIELD_NUMBER = 4; + private boolean generateProbabilities_; + /** + *
+   *Does the model generate probabilities
+   * 
+ * + * bool generate_probabilities = 4; + * @return The generateProbabilities. + */ + @java.lang.Override + public boolean getGenerateProbabilities() { + return generateProbabilities_; + } + + public static final int FEATURE_DOMAIN_FIELD_NUMBER = 5; + private org.tribuo.protos.core.FeatureDomainProto featureDomain_; + /** + *
+   *Model feature domain
+   * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + * @return Whether the featureDomain field is set. + */ + @java.lang.Override + public boolean hasFeatureDomain() { + return featureDomain_ != null; + } + /** + *
+   *Model feature domain
+   * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + * @return The featureDomain. + */ + @java.lang.Override + public org.tribuo.protos.core.FeatureDomainProto getFeatureDomain() { + return featureDomain_ == null ? org.tribuo.protos.core.FeatureDomainProto.getDefaultInstance() : featureDomain_; + } + /** + *
+   *Model feature domain
+   * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + */ + @java.lang.Override + public org.tribuo.protos.core.FeatureDomainProtoOrBuilder getFeatureDomainOrBuilder() { + return getFeatureDomain(); + } + + public static final int OUTPUT_DOMAIN_FIELD_NUMBER = 6; + private org.tribuo.protos.core.OutputDomainProto outputDomain_; + /** + *
+   *Model output domain
+   * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + * @return Whether the outputDomain field is set. + */ + @java.lang.Override + public boolean hasOutputDomain() { + return outputDomain_ != null; + } + /** + *
+   *Model output domain
+   * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + * @return The outputDomain. + */ + @java.lang.Override + public org.tribuo.protos.core.OutputDomainProto getOutputDomain() { + return outputDomain_ == null ? org.tribuo.protos.core.OutputDomainProto.getDefaultInstance() : outputDomain_; + } + /** + *
+   *Model output domain
+   * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + */ + @java.lang.Override + public org.tribuo.protos.core.OutputDomainProtoOrBuilder getOutputDomainOrBuilder() { + return getOutputDomain(); + } + + public static final int MODEL_DATA_FIELD_NUMBER = 7; + private org.tribuo.protos.core.ModelDataProto modelData_; + /** + *
+   *Model data
+   * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + * @return Whether the modelData field is set. + */ + @java.lang.Override + public boolean hasModelData() { + return modelData_ != null; + } + /** + *
+   *Model data
+   * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + * @return The modelData. + */ + @java.lang.Override + public org.tribuo.protos.core.ModelDataProto getModelData() { + return modelData_ == null ? org.tribuo.protos.core.ModelDataProto.getDefaultInstance() : modelData_; + } + /** + *
+   *Model data
+   * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + */ + @java.lang.Override + public org.tribuo.protos.core.ModelDataProtoOrBuilder getModelDataOrBuilder() { + return getModelData(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_); + } + if (provenance_ != null) { + output.writeMessage(3, getProvenance()); + } + if (generateProbabilities_ != false) { + output.writeBool(4, generateProbabilities_); + } + if (featureDomain_ != null) { + output.writeMessage(5, getFeatureDomain()); + } + if (outputDomain_ != null) { + output.writeMessage(6, getOutputDomain()); + } + if (modelData_ != null) { + output.writeMessage(7, getModelData()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_); + } + if (provenance_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getProvenance()); + } + if (generateProbabilities_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, generateProbabilities_); + } + if (featureDomain_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, getFeatureDomain()); + } + if (outputDomain_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getOutputDomain()); + } + if (modelData_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, getModelData()); + } + 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 org.tribuo.protos.core.ModelProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.ModelProto other = (org.tribuo.protos.core.ModelProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getName() + .equals(other.getName())) return false; + if (hasProvenance() != other.hasProvenance()) return false; + if (hasProvenance()) { + if (!getProvenance() + .equals(other.getProvenance())) return false; + } + if (getGenerateProbabilities() + != other.getGenerateProbabilities()) return false; + if (hasFeatureDomain() != other.hasFeatureDomain()) return false; + if (hasFeatureDomain()) { + if (!getFeatureDomain() + .equals(other.getFeatureDomain())) return false; + } + if (hasOutputDomain() != other.hasOutputDomain()) return false; + if (hasOutputDomain()) { + if (!getOutputDomain() + .equals(other.getOutputDomain())) return false; + } + if (hasModelData() != other.hasModelData()) return false; + if (hasModelData()) { + if (!getModelData() + .equals(other.getModelData())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasProvenance()) { + hash = (37 * hash) + PROVENANCE_FIELD_NUMBER; + hash = (53 * hash) + getProvenance().hashCode(); + } + hash = (37 * hash) + GENERATE_PROBABILITIES_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getGenerateProbabilities()); + if (hasFeatureDomain()) { + hash = (37 * hash) + FEATURE_DOMAIN_FIELD_NUMBER; + hash = (53 * hash) + getFeatureDomain().hashCode(); + } + if (hasOutputDomain()) { + hash = (37 * hash) + OUTPUT_DOMAIN_FIELD_NUMBER; + hash = (53 * hash) + getOutputDomain().hashCode(); + } + if (hasModelData()) { + hash = (37 * hash) + MODEL_DATA_FIELD_NUMBER; + hash = (53 * hash) + getModelData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.ModelProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ModelProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ModelProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ModelProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ModelProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.ModelProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.ModelProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ModelProto 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 org.tribuo.protos.core.ModelProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ModelProto 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 org.tribuo.protos.core.ModelProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.ModelProto 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(org.tribuo.protos.core.ModelProto 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; + } + /** + *
+   *Base model protobuf. Contains the core model fields, along with an Any containing model specific information.
+   * 
+ * + * Protobuf type {@code tribuo.core.ModelProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.ModelProto) + org.tribuo.protos.core.ModelProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ModelProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ModelProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.ModelProto.class, org.tribuo.protos.core.ModelProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.ModelProto.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(); + version_ = 0; + + name_ = ""; + + if (provenanceBuilder_ == null) { + provenance_ = null; + } else { + provenance_ = null; + provenanceBuilder_ = null; + } + generateProbabilities_ = false; + + if (featureDomainBuilder_ == null) { + featureDomain_ = null; + } else { + featureDomain_ = null; + featureDomainBuilder_ = null; + } + if (outputDomainBuilder_ == null) { + outputDomain_ = null; + } else { + outputDomain_ = null; + outputDomainBuilder_ = null; + } + if (modelDataBuilder_ == null) { + modelData_ = null; + } else { + modelData_ = null; + modelDataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_ModelProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.ModelProto getDefaultInstanceForType() { + return org.tribuo.protos.core.ModelProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.ModelProto build() { + org.tribuo.protos.core.ModelProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.ModelProto buildPartial() { + org.tribuo.protos.core.ModelProto result = new org.tribuo.protos.core.ModelProto(this); + result.version_ = version_; + result.name_ = name_; + if (provenanceBuilder_ == null) { + result.provenance_ = provenance_; + } else { + result.provenance_ = provenanceBuilder_.build(); + } + result.generateProbabilities_ = generateProbabilities_; + if (featureDomainBuilder_ == null) { + result.featureDomain_ = featureDomain_; + } else { + result.featureDomain_ = featureDomainBuilder_.build(); + } + if (outputDomainBuilder_ == null) { + result.outputDomain_ = outputDomain_; + } else { + result.outputDomain_ = outputDomainBuilder_.build(); + } + if (modelDataBuilder_ == null) { + result.modelData_ = modelData_; + } else { + result.modelData_ = modelDataBuilder_.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 org.tribuo.protos.core.ModelProto) { + return mergeFrom((org.tribuo.protos.core.ModelProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.ModelProto other) { + if (other == org.tribuo.protos.core.ModelProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.hasProvenance()) { + mergeProvenance(other.getProvenance()); + } + if (other.getGenerateProbabilities() != false) { + setGenerateProbabilities(other.getGenerateProbabilities()); + } + if (other.hasFeatureDomain()) { + mergeFeatureDomain(other.getFeatureDomain()); + } + if (other.hasOutputDomain()) { + mergeOutputDomain(other.getOutputDomain()); + } + if (other.hasModelData()) { + mergeModelData(other.getModelData()); + } + 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 { + org.tribuo.protos.core.ModelProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.ModelProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int version_ ; + /** + *
+     *Version number of the model proto
+     * 
+ * + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + *
+     *Version number of the model proto
+     * 
+ * + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + *
+     *Version number of the model proto
+     * 
+ * + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     *The model 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; + } + } + /** + *
+     *The model name
+     * 
+ * + * 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; + } + } + /** + *
+     *The model name
+     * 
+ * + * 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; + } + /** + *
+     *The model name
+     * 
+ * + * string name = 2; + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     *The model name
+     * 
+ * + * 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; + } + + private com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto provenance_; + private com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder> provenanceBuilder_; + /** + *
+     *The model provenance
+     * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + * @return Whether the provenance field is set. + */ + public boolean hasProvenance() { + return provenanceBuilder_ != null || provenance_ != null; + } + /** + *
+     *The model provenance
+     * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + * @return The provenance. + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getProvenance() { + if (provenanceBuilder_ == null) { + return provenance_ == null ? com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : provenance_; + } else { + return provenanceBuilder_.getMessage(); + } + } + /** + *
+     *The model provenance
+     * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + */ + public Builder setProvenance(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto value) { + if (provenanceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + provenance_ = value; + onChanged(); + } else { + provenanceBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     *The model provenance
+     * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + */ + public Builder setProvenance( + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder builderForValue) { + if (provenanceBuilder_ == null) { + provenance_ = builderForValue.build(); + onChanged(); + } else { + provenanceBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     *The model provenance
+     * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + */ + public Builder mergeProvenance(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto value) { + if (provenanceBuilder_ == null) { + if (provenance_ != null) { + provenance_ = + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.newBuilder(provenance_).mergeFrom(value).buildPartial(); + } else { + provenance_ = value; + } + onChanged(); + } else { + provenanceBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     *The model provenance
+     * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + */ + public Builder clearProvenance() { + if (provenanceBuilder_ == null) { + provenance_ = null; + onChanged(); + } else { + provenance_ = null; + provenanceBuilder_ = null; + } + + return this; + } + /** + *
+     *The model provenance
+     * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder getProvenanceBuilder() { + + onChanged(); + return getProvenanceFieldBuilder().getBuilder(); + } + /** + *
+     *The model provenance
+     * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getProvenanceOrBuilder() { + if (provenanceBuilder_ != null) { + return provenanceBuilder_.getMessageOrBuilder(); + } else { + return provenance_ == null ? + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : provenance_; + } + } + /** + *
+     *The model provenance
+     * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder> + getProvenanceFieldBuilder() { + if (provenanceBuilder_ == null) { + provenanceBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder>( + getProvenance(), + getParentForChildren(), + isClean()); + provenance_ = null; + } + return provenanceBuilder_; + } + + private boolean generateProbabilities_ ; + /** + *
+     *Does the model generate probabilities
+     * 
+ * + * bool generate_probabilities = 4; + * @return The generateProbabilities. + */ + @java.lang.Override + public boolean getGenerateProbabilities() { + return generateProbabilities_; + } + /** + *
+     *Does the model generate probabilities
+     * 
+ * + * bool generate_probabilities = 4; + * @param value The generateProbabilities to set. + * @return This builder for chaining. + */ + public Builder setGenerateProbabilities(boolean value) { + + generateProbabilities_ = value; + onChanged(); + return this; + } + /** + *
+     *Does the model generate probabilities
+     * 
+ * + * bool generate_probabilities = 4; + * @return This builder for chaining. + */ + public Builder clearGenerateProbabilities() { + + generateProbabilities_ = false; + onChanged(); + return this; + } + + private org.tribuo.protos.core.FeatureDomainProto featureDomain_; + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.FeatureDomainProto, org.tribuo.protos.core.FeatureDomainProto.Builder, org.tribuo.protos.core.FeatureDomainProtoOrBuilder> featureDomainBuilder_; + /** + *
+     *Model feature domain
+     * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + * @return Whether the featureDomain field is set. + */ + public boolean hasFeatureDomain() { + return featureDomainBuilder_ != null || featureDomain_ != null; + } + /** + *
+     *Model feature domain
+     * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + * @return The featureDomain. + */ + public org.tribuo.protos.core.FeatureDomainProto getFeatureDomain() { + if (featureDomainBuilder_ == null) { + return featureDomain_ == null ? org.tribuo.protos.core.FeatureDomainProto.getDefaultInstance() : featureDomain_; + } else { + return featureDomainBuilder_.getMessage(); + } + } + /** + *
+     *Model feature domain
+     * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + */ + public Builder setFeatureDomain(org.tribuo.protos.core.FeatureDomainProto value) { + if (featureDomainBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + featureDomain_ = value; + onChanged(); + } else { + featureDomainBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     *Model feature domain
+     * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + */ + public Builder setFeatureDomain( + org.tribuo.protos.core.FeatureDomainProto.Builder builderForValue) { + if (featureDomainBuilder_ == null) { + featureDomain_ = builderForValue.build(); + onChanged(); + } else { + featureDomainBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     *Model feature domain
+     * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + */ + public Builder mergeFeatureDomain(org.tribuo.protos.core.FeatureDomainProto value) { + if (featureDomainBuilder_ == null) { + if (featureDomain_ != null) { + featureDomain_ = + org.tribuo.protos.core.FeatureDomainProto.newBuilder(featureDomain_).mergeFrom(value).buildPartial(); + } else { + featureDomain_ = value; + } + onChanged(); + } else { + featureDomainBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     *Model feature domain
+     * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + */ + public Builder clearFeatureDomain() { + if (featureDomainBuilder_ == null) { + featureDomain_ = null; + onChanged(); + } else { + featureDomain_ = null; + featureDomainBuilder_ = null; + } + + return this; + } + /** + *
+     *Model feature domain
+     * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + */ + public org.tribuo.protos.core.FeatureDomainProto.Builder getFeatureDomainBuilder() { + + onChanged(); + return getFeatureDomainFieldBuilder().getBuilder(); + } + /** + *
+     *Model feature domain
+     * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + */ + public org.tribuo.protos.core.FeatureDomainProtoOrBuilder getFeatureDomainOrBuilder() { + if (featureDomainBuilder_ != null) { + return featureDomainBuilder_.getMessageOrBuilder(); + } else { + return featureDomain_ == null ? + org.tribuo.protos.core.FeatureDomainProto.getDefaultInstance() : featureDomain_; + } + } + /** + *
+     *Model feature domain
+     * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.FeatureDomainProto, org.tribuo.protos.core.FeatureDomainProto.Builder, org.tribuo.protos.core.FeatureDomainProtoOrBuilder> + getFeatureDomainFieldBuilder() { + if (featureDomainBuilder_ == null) { + featureDomainBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.FeatureDomainProto, org.tribuo.protos.core.FeatureDomainProto.Builder, org.tribuo.protos.core.FeatureDomainProtoOrBuilder>( + getFeatureDomain(), + getParentForChildren(), + isClean()); + featureDomain_ = null; + } + return featureDomainBuilder_; + } + + private org.tribuo.protos.core.OutputDomainProto outputDomain_; + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputDomainProto, org.tribuo.protos.core.OutputDomainProto.Builder, org.tribuo.protos.core.OutputDomainProtoOrBuilder> outputDomainBuilder_; + /** + *
+     *Model output domain
+     * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + * @return Whether the outputDomain field is set. + */ + public boolean hasOutputDomain() { + return outputDomainBuilder_ != null || outputDomain_ != null; + } + /** + *
+     *Model output domain
+     * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + * @return The outputDomain. + */ + public org.tribuo.protos.core.OutputDomainProto getOutputDomain() { + if (outputDomainBuilder_ == null) { + return outputDomain_ == null ? org.tribuo.protos.core.OutputDomainProto.getDefaultInstance() : outputDomain_; + } else { + return outputDomainBuilder_.getMessage(); + } + } + /** + *
+     *Model output domain
+     * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + */ + public Builder setOutputDomain(org.tribuo.protos.core.OutputDomainProto value) { + if (outputDomainBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + outputDomain_ = value; + onChanged(); + } else { + outputDomainBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     *Model output domain
+     * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + */ + public Builder setOutputDomain( + org.tribuo.protos.core.OutputDomainProto.Builder builderForValue) { + if (outputDomainBuilder_ == null) { + outputDomain_ = builderForValue.build(); + onChanged(); + } else { + outputDomainBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     *Model output domain
+     * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + */ + public Builder mergeOutputDomain(org.tribuo.protos.core.OutputDomainProto value) { + if (outputDomainBuilder_ == null) { + if (outputDomain_ != null) { + outputDomain_ = + org.tribuo.protos.core.OutputDomainProto.newBuilder(outputDomain_).mergeFrom(value).buildPartial(); + } else { + outputDomain_ = value; + } + onChanged(); + } else { + outputDomainBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     *Model output domain
+     * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + */ + public Builder clearOutputDomain() { + if (outputDomainBuilder_ == null) { + outputDomain_ = null; + onChanged(); + } else { + outputDomain_ = null; + outputDomainBuilder_ = null; + } + + return this; + } + /** + *
+     *Model output domain
+     * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + */ + public org.tribuo.protos.core.OutputDomainProto.Builder getOutputDomainBuilder() { + + onChanged(); + return getOutputDomainFieldBuilder().getBuilder(); + } + /** + *
+     *Model output domain
+     * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + */ + public org.tribuo.protos.core.OutputDomainProtoOrBuilder getOutputDomainOrBuilder() { + if (outputDomainBuilder_ != null) { + return outputDomainBuilder_.getMessageOrBuilder(); + } else { + return outputDomain_ == null ? + org.tribuo.protos.core.OutputDomainProto.getDefaultInstance() : outputDomain_; + } + } + /** + *
+     *Model output domain
+     * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputDomainProto, org.tribuo.protos.core.OutputDomainProto.Builder, org.tribuo.protos.core.OutputDomainProtoOrBuilder> + getOutputDomainFieldBuilder() { + if (outputDomainBuilder_ == null) { + outputDomainBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputDomainProto, org.tribuo.protos.core.OutputDomainProto.Builder, org.tribuo.protos.core.OutputDomainProtoOrBuilder>( + getOutputDomain(), + getParentForChildren(), + isClean()); + outputDomain_ = null; + } + return outputDomainBuilder_; + } + + private org.tribuo.protos.core.ModelDataProto modelData_; + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.ModelDataProto, org.tribuo.protos.core.ModelDataProto.Builder, org.tribuo.protos.core.ModelDataProtoOrBuilder> modelDataBuilder_; + /** + *
+     *Model data
+     * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + * @return Whether the modelData field is set. + */ + public boolean hasModelData() { + return modelDataBuilder_ != null || modelData_ != null; + } + /** + *
+     *Model data
+     * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + * @return The modelData. + */ + public org.tribuo.protos.core.ModelDataProto getModelData() { + if (modelDataBuilder_ == null) { + return modelData_ == null ? org.tribuo.protos.core.ModelDataProto.getDefaultInstance() : modelData_; + } else { + return modelDataBuilder_.getMessage(); + } + } + /** + *
+     *Model data
+     * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + */ + public Builder setModelData(org.tribuo.protos.core.ModelDataProto value) { + if (modelDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + modelData_ = value; + onChanged(); + } else { + modelDataBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     *Model data
+     * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + */ + public Builder setModelData( + org.tribuo.protos.core.ModelDataProto.Builder builderForValue) { + if (modelDataBuilder_ == null) { + modelData_ = builderForValue.build(); + onChanged(); + } else { + modelDataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     *Model data
+     * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + */ + public Builder mergeModelData(org.tribuo.protos.core.ModelDataProto value) { + if (modelDataBuilder_ == null) { + if (modelData_ != null) { + modelData_ = + org.tribuo.protos.core.ModelDataProto.newBuilder(modelData_).mergeFrom(value).buildPartial(); + } else { + modelData_ = value; + } + onChanged(); + } else { + modelDataBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     *Model data
+     * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + */ + public Builder clearModelData() { + if (modelDataBuilder_ == null) { + modelData_ = null; + onChanged(); + } else { + modelData_ = null; + modelDataBuilder_ = null; + } + + return this; + } + /** + *
+     *Model data
+     * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + */ + public org.tribuo.protos.core.ModelDataProto.Builder getModelDataBuilder() { + + onChanged(); + return getModelDataFieldBuilder().getBuilder(); + } + /** + *
+     *Model data
+     * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + */ + public org.tribuo.protos.core.ModelDataProtoOrBuilder getModelDataOrBuilder() { + if (modelDataBuilder_ != null) { + return modelDataBuilder_.getMessageOrBuilder(); + } else { + return modelData_ == null ? + org.tribuo.protos.core.ModelDataProto.getDefaultInstance() : modelData_; + } + } + /** + *
+     *Model data
+     * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.ModelDataProto, org.tribuo.protos.core.ModelDataProto.Builder, org.tribuo.protos.core.ModelDataProtoOrBuilder> + getModelDataFieldBuilder() { + if (modelDataBuilder_ == null) { + modelDataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.ModelDataProto, org.tribuo.protos.core.ModelDataProto.Builder, org.tribuo.protos.core.ModelDataProtoOrBuilder>( + getModelData(), + getParentForChildren(), + isClean()); + modelData_ = null; + } + return modelDataBuilder_; + } + @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:tribuo.core.ModelProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.ModelProto) + private static final org.tribuo.protos.core.ModelProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.ModelProto(); + } + + public static org.tribuo.protos.core.ModelProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ModelProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ModelProto(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 org.tribuo.protos.core.ModelProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/ModelProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/ModelProtoOrBuilder.java new file mode 100644 index 000000000..dc0dad2e1 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/ModelProtoOrBuilder.java @@ -0,0 +1,157 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface ModelProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.ModelProto) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   *Version number of the model proto
+   * 
+ * + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + *
+   *The model name
+   * 
+ * + * string name = 2; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   *The model name
+   * 
+ * + * string name = 2; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   *The model provenance
+   * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + * @return Whether the provenance field is set. + */ + boolean hasProvenance(); + /** + *
+   *The model provenance
+   * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + * @return The provenance. + */ + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getProvenance(); + /** + *
+   *The model provenance
+   * 
+ * + * .olcut.RootProvenanceProto provenance = 3; + */ + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getProvenanceOrBuilder(); + + /** + *
+   *Does the model generate probabilities
+   * 
+ * + * bool generate_probabilities = 4; + * @return The generateProbabilities. + */ + boolean getGenerateProbabilities(); + + /** + *
+   *Model feature domain
+   * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + * @return Whether the featureDomain field is set. + */ + boolean hasFeatureDomain(); + /** + *
+   *Model feature domain
+   * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + * @return The featureDomain. + */ + org.tribuo.protos.core.FeatureDomainProto getFeatureDomain(); + /** + *
+   *Model feature domain
+   * 
+ * + * .tribuo.core.FeatureDomainProto feature_domain = 5; + */ + org.tribuo.protos.core.FeatureDomainProtoOrBuilder getFeatureDomainOrBuilder(); + + /** + *
+   *Model output domain
+   * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + * @return Whether the outputDomain field is set. + */ + boolean hasOutputDomain(); + /** + *
+   *Model output domain
+   * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + * @return The outputDomain. + */ + org.tribuo.protos.core.OutputDomainProto getOutputDomain(); + /** + *
+   *Model output domain
+   * 
+ * + * .tribuo.core.OutputDomainProto output_domain = 6; + */ + org.tribuo.protos.core.OutputDomainProtoOrBuilder getOutputDomainOrBuilder(); + + /** + *
+   *Model data
+   * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + * @return Whether the modelData field is set. + */ + boolean hasModelData(); + /** + *
+   *Model data
+   * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + * @return The modelData. + */ + org.tribuo.protos.core.ModelDataProto getModelData(); + /** + *
+   *Model data
+   * 
+ * + * .tribuo.core.ModelDataProto model_data = 7; + */ + org.tribuo.protos.core.ModelDataProtoOrBuilder getModelDataOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/MutableFeatureMapProto.java b/Core/src/main/java/org/tribuo/protos/core/MutableFeatureMapProto.java new file mode 100644 index 000000000..a4e6928af --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/MutableFeatureMapProto.java @@ -0,0 +1,845 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *MutableFeatureMap proto
+ * 
+ * + * Protobuf type {@code tribuo.core.MutableFeatureMapProto} + */ +public final class MutableFeatureMapProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.MutableFeatureMapProto) + MutableFeatureMapProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use MutableFeatureMapProto.newBuilder() to construct. + private MutableFeatureMapProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private MutableFeatureMapProto() { + info_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new MutableFeatureMapProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private MutableFeatureMapProto( + 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: { + + convertHighCardinality_ = input.readBool(); + break; + } + case 18: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + info_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + info_.add( + input.readMessage(org.tribuo.protos.core.VariableInfoProto.parser(), extensionRegistry)); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + info_ = java.util.Collections.unmodifiableList(info_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MutableFeatureMapProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MutableFeatureMapProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.MutableFeatureMapProto.class, org.tribuo.protos.core.MutableFeatureMapProto.Builder.class); + } + + public static final int CONVERT_HIGH_CARDINALITY_FIELD_NUMBER = 1; + private boolean convertHighCardinality_; + /** + * bool convert_high_cardinality = 1; + * @return The convertHighCardinality. + */ + @java.lang.Override + public boolean getConvertHighCardinality() { + return convertHighCardinality_; + } + + public static final int INFO_FIELD_NUMBER = 2; + private java.util.List info_; + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + @java.lang.Override + public java.util.List getInfoList() { + return info_; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + @java.lang.Override + public java.util.List + getInfoOrBuilderList() { + return info_; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + @java.lang.Override + public int getInfoCount() { + return info_.size(); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + @java.lang.Override + public org.tribuo.protos.core.VariableInfoProto getInfo(int index) { + return info_.get(index); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + @java.lang.Override + public org.tribuo.protos.core.VariableInfoProtoOrBuilder getInfoOrBuilder( + int index) { + return info_.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 { + if (convertHighCardinality_ != false) { + output.writeBool(1, convertHighCardinality_); + } + for (int i = 0; i < info_.size(); i++) { + output.writeMessage(2, info_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (convertHighCardinality_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, convertHighCardinality_); + } + for (int i = 0; i < info_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, info_.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 org.tribuo.protos.core.MutableFeatureMapProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.MutableFeatureMapProto other = (org.tribuo.protos.core.MutableFeatureMapProto) obj; + + if (getConvertHighCardinality() + != other.getConvertHighCardinality()) return false; + if (!getInfoList() + .equals(other.getInfoList())) 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) + CONVERT_HIGH_CARDINALITY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getConvertHighCardinality()); + if (getInfoCount() > 0) { + hash = (37 * hash) + INFO_FIELD_NUMBER; + hash = (53 * hash) + getInfoList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.MutableFeatureMapProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MutableFeatureMapProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MutableFeatureMapProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MutableFeatureMapProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MutableFeatureMapProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.MutableFeatureMapProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.MutableFeatureMapProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MutableFeatureMapProto 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 org.tribuo.protos.core.MutableFeatureMapProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MutableFeatureMapProto 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 org.tribuo.protos.core.MutableFeatureMapProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.MutableFeatureMapProto 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(org.tribuo.protos.core.MutableFeatureMapProto 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; + } + /** + *
+   *MutableFeatureMap proto
+   * 
+ * + * Protobuf type {@code tribuo.core.MutableFeatureMapProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.MutableFeatureMapProto) + org.tribuo.protos.core.MutableFeatureMapProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MutableFeatureMapProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MutableFeatureMapProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.MutableFeatureMapProto.class, org.tribuo.protos.core.MutableFeatureMapProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.MutableFeatureMapProto.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getInfoFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + convertHighCardinality_ = false; + + if (infoBuilder_ == null) { + info_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + infoBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_MutableFeatureMapProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.MutableFeatureMapProto getDefaultInstanceForType() { + return org.tribuo.protos.core.MutableFeatureMapProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.MutableFeatureMapProto build() { + org.tribuo.protos.core.MutableFeatureMapProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.MutableFeatureMapProto buildPartial() { + org.tribuo.protos.core.MutableFeatureMapProto result = new org.tribuo.protos.core.MutableFeatureMapProto(this); + int from_bitField0_ = bitField0_; + result.convertHighCardinality_ = convertHighCardinality_; + if (infoBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + info_ = java.util.Collections.unmodifiableList(info_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.info_ = info_; + } else { + result.info_ = infoBuilder_.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 org.tribuo.protos.core.MutableFeatureMapProto) { + return mergeFrom((org.tribuo.protos.core.MutableFeatureMapProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.MutableFeatureMapProto other) { + if (other == org.tribuo.protos.core.MutableFeatureMapProto.getDefaultInstance()) return this; + if (other.getConvertHighCardinality() != false) { + setConvertHighCardinality(other.getConvertHighCardinality()); + } + if (infoBuilder_ == null) { + if (!other.info_.isEmpty()) { + if (info_.isEmpty()) { + info_ = other.info_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureInfoIsMutable(); + info_.addAll(other.info_); + } + onChanged(); + } + } else { + if (!other.info_.isEmpty()) { + if (infoBuilder_.isEmpty()) { + infoBuilder_.dispose(); + infoBuilder_ = null; + info_ = other.info_; + bitField0_ = (bitField0_ & ~0x00000001); + infoBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getInfoFieldBuilder() : null; + } else { + infoBuilder_.addAllMessages(other.info_); + } + } + } + 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 { + org.tribuo.protos.core.MutableFeatureMapProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.MutableFeatureMapProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private boolean convertHighCardinality_ ; + /** + * bool convert_high_cardinality = 1; + * @return The convertHighCardinality. + */ + @java.lang.Override + public boolean getConvertHighCardinality() { + return convertHighCardinality_; + } + /** + * bool convert_high_cardinality = 1; + * @param value The convertHighCardinality to set. + * @return This builder for chaining. + */ + public Builder setConvertHighCardinality(boolean value) { + + convertHighCardinality_ = value; + onChanged(); + return this; + } + /** + * bool convert_high_cardinality = 1; + * @return This builder for chaining. + */ + public Builder clearConvertHighCardinality() { + + convertHighCardinality_ = false; + onChanged(); + return this; + } + + private java.util.List info_ = + java.util.Collections.emptyList(); + private void ensureInfoIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + info_ = new java.util.ArrayList(info_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.VariableInfoProto, org.tribuo.protos.core.VariableInfoProto.Builder, org.tribuo.protos.core.VariableInfoProtoOrBuilder> infoBuilder_; + + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public java.util.List getInfoList() { + if (infoBuilder_ == null) { + return java.util.Collections.unmodifiableList(info_); + } else { + return infoBuilder_.getMessageList(); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public int getInfoCount() { + if (infoBuilder_ == null) { + return info_.size(); + } else { + return infoBuilder_.getCount(); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public org.tribuo.protos.core.VariableInfoProto getInfo(int index) { + if (infoBuilder_ == null) { + return info_.get(index); + } else { + return infoBuilder_.getMessage(index); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder setInfo( + int index, org.tribuo.protos.core.VariableInfoProto value) { + if (infoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInfoIsMutable(); + info_.set(index, value); + onChanged(); + } else { + infoBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder setInfo( + int index, org.tribuo.protos.core.VariableInfoProto.Builder builderForValue) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.set(index, builderForValue.build()); + onChanged(); + } else { + infoBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder addInfo(org.tribuo.protos.core.VariableInfoProto value) { + if (infoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInfoIsMutable(); + info_.add(value); + onChanged(); + } else { + infoBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder addInfo( + int index, org.tribuo.protos.core.VariableInfoProto value) { + if (infoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInfoIsMutable(); + info_.add(index, value); + onChanged(); + } else { + infoBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder addInfo( + org.tribuo.protos.core.VariableInfoProto.Builder builderForValue) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.add(builderForValue.build()); + onChanged(); + } else { + infoBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder addInfo( + int index, org.tribuo.protos.core.VariableInfoProto.Builder builderForValue) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.add(index, builderForValue.build()); + onChanged(); + } else { + infoBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder addAllInfo( + java.lang.Iterable values) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, info_); + onChanged(); + } else { + infoBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder clearInfo() { + if (infoBuilder_ == null) { + info_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + infoBuilder_.clear(); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public Builder removeInfo(int index) { + if (infoBuilder_ == null) { + ensureInfoIsMutable(); + info_.remove(index); + onChanged(); + } else { + infoBuilder_.remove(index); + } + return this; + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public org.tribuo.protos.core.VariableInfoProto.Builder getInfoBuilder( + int index) { + return getInfoFieldBuilder().getBuilder(index); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public org.tribuo.protos.core.VariableInfoProtoOrBuilder getInfoOrBuilder( + int index) { + if (infoBuilder_ == null) { + return info_.get(index); } else { + return infoBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public java.util.List + getInfoOrBuilderList() { + if (infoBuilder_ != null) { + return infoBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(info_); + } + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public org.tribuo.protos.core.VariableInfoProto.Builder addInfoBuilder() { + return getInfoFieldBuilder().addBuilder( + org.tribuo.protos.core.VariableInfoProto.getDefaultInstance()); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public org.tribuo.protos.core.VariableInfoProto.Builder addInfoBuilder( + int index) { + return getInfoFieldBuilder().addBuilder( + index, org.tribuo.protos.core.VariableInfoProto.getDefaultInstance()); + } + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + public java.util.List + getInfoBuilderList() { + return getInfoFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.VariableInfoProto, org.tribuo.protos.core.VariableInfoProto.Builder, org.tribuo.protos.core.VariableInfoProtoOrBuilder> + getInfoFieldBuilder() { + if (infoBuilder_ == null) { + infoBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.VariableInfoProto, org.tribuo.protos.core.VariableInfoProto.Builder, org.tribuo.protos.core.VariableInfoProtoOrBuilder>( + info_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + info_ = null; + } + return infoBuilder_; + } + @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:tribuo.core.MutableFeatureMapProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.MutableFeatureMapProto) + private static final org.tribuo.protos.core.MutableFeatureMapProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.MutableFeatureMapProto(); + } + + public static org.tribuo.protos.core.MutableFeatureMapProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MutableFeatureMapProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new MutableFeatureMapProto(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 org.tribuo.protos.core.MutableFeatureMapProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/MutableFeatureMapProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/MutableFeatureMapProtoOrBuilder.java new file mode 100644 index 000000000..666cb9b6b --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/MutableFeatureMapProtoOrBuilder.java @@ -0,0 +1,39 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface MutableFeatureMapProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.MutableFeatureMapProto) + com.google.protobuf.MessageOrBuilder { + + /** + * bool convert_high_cardinality = 1; + * @return The convertHighCardinality. + */ + boolean getConvertHighCardinality(); + + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + java.util.List + getInfoList(); + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + org.tribuo.protos.core.VariableInfoProto getInfo(int index); + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + int getInfoCount(); + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + java.util.List + getInfoOrBuilderList(); + /** + * repeated .tribuo.core.VariableInfoProto info = 2; + */ + org.tribuo.protos.core.VariableInfoProtoOrBuilder getInfoOrBuilder( + int index); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/OutputDomainProto.java b/Core/src/main/java/org/tribuo/protos/core/OutputDomainProto.java new file mode 100644 index 000000000..b64635f46 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/OutputDomainProto.java @@ -0,0 +1,819 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Output domain redirection proto
+ * 
+ * + * Protobuf type {@code tribuo.core.OutputDomainProto} + */ +public final class OutputDomainProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.OutputDomainProto) + OutputDomainProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use OutputDomainProto.newBuilder() to construct. + private OutputDomainProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private OutputDomainProto() { + className_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new OutputDomainProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private OutputDomainProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + com.google.protobuf.Any.Builder subBuilder = null; + if (serializedData_ != null) { + subBuilder = serializedData_.toBuilder(); + } + serializedData_ = input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(serializedData_); + serializedData_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputDomainProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputDomainProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.OutputDomainProto.class, org.tribuo.protos.core.OutputDomainProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERIALIZED_DATA_FIELD_NUMBER = 3; + private com.google.protobuf.Any serializedData_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + @java.lang.Override + public boolean hasSerializedData() { + return serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + @java.lang.Override + public com.google.protobuf.Any getSerializedData() { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + @java.lang.Override + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + return getSerializedData(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (serializedData_ != null) { + output.writeMessage(3, getSerializedData()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (serializedData_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getSerializedData()); + } + 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 org.tribuo.protos.core.OutputDomainProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.OutputDomainProto other = (org.tribuo.protos.core.OutputDomainProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasSerializedData() != other.hasSerializedData()) return false; + if (hasSerializedData()) { + if (!getSerializedData() + .equals(other.getSerializedData())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasSerializedData()) { + hash = (37 * hash) + SERIALIZED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getSerializedData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.OutputDomainProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.OutputDomainProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.OutputDomainProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.OutputDomainProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.OutputDomainProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.OutputDomainProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.OutputDomainProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.OutputDomainProto 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 org.tribuo.protos.core.OutputDomainProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.OutputDomainProto 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 org.tribuo.protos.core.OutputDomainProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.OutputDomainProto 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(org.tribuo.protos.core.OutputDomainProto 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; + } + /** + *
+   *Output domain redirection proto
+   * 
+ * + * Protobuf type {@code tribuo.core.OutputDomainProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.OutputDomainProto) + org.tribuo.protos.core.OutputDomainProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputDomainProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputDomainProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.OutputDomainProto.class, org.tribuo.protos.core.OutputDomainProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.OutputDomainProto.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(); + version_ = 0; + + className_ = ""; + + if (serializedDataBuilder_ == null) { + serializedData_ = null; + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputDomainProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.OutputDomainProto getDefaultInstanceForType() { + return org.tribuo.protos.core.OutputDomainProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.OutputDomainProto build() { + org.tribuo.protos.core.OutputDomainProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.OutputDomainProto buildPartial() { + org.tribuo.protos.core.OutputDomainProto result = new org.tribuo.protos.core.OutputDomainProto(this); + result.version_ = version_; + result.className_ = className_; + if (serializedDataBuilder_ == null) { + result.serializedData_ = serializedData_; + } else { + result.serializedData_ = serializedDataBuilder_.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 org.tribuo.protos.core.OutputDomainProto) { + return mergeFrom((org.tribuo.protos.core.OutputDomainProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.OutputDomainProto other) { + if (other == org.tribuo.protos.core.OutputDomainProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasSerializedData()) { + mergeSerializedData(other.getSerializedData()); + } + 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 { + org.tribuo.protos.core.OutputDomainProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.OutputDomainProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Any serializedData_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> serializedDataBuilder_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + public boolean hasSerializedData() { + return serializedDataBuilder_ != null || serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + public com.google.protobuf.Any getSerializedData() { + if (serializedDataBuilder_ == null) { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } else { + return serializedDataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + serializedData_ = value; + onChanged(); + } else { + serializedDataBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData( + com.google.protobuf.Any.Builder builderForValue) { + if (serializedDataBuilder_ == null) { + serializedData_ = builderForValue.build(); + onChanged(); + } else { + serializedDataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder mergeSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (serializedData_ != null) { + serializedData_ = + com.google.protobuf.Any.newBuilder(serializedData_).mergeFrom(value).buildPartial(); + } else { + serializedData_ = value; + } + onChanged(); + } else { + serializedDataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder clearSerializedData() { + if (serializedDataBuilder_ == null) { + serializedData_ = null; + onChanged(); + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.Any.Builder getSerializedDataBuilder() { + + onChanged(); + return getSerializedDataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + if (serializedDataBuilder_ != null) { + return serializedDataBuilder_.getMessageOrBuilder(); + } else { + return serializedData_ == null ? + com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> + getSerializedDataFieldBuilder() { + if (serializedDataBuilder_ == null) { + serializedDataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( + getSerializedData(), + getParentForChildren(), + isClean()); + serializedData_ = null; + } + return serializedDataBuilder_; + } + @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:tribuo.core.OutputDomainProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.OutputDomainProto) + private static final org.tribuo.protos.core.OutputDomainProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.OutputDomainProto(); + } + + public static org.tribuo.protos.core.OutputDomainProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OutputDomainProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new OutputDomainProto(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 org.tribuo.protos.core.OutputDomainProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/OutputDomainProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/OutputDomainProtoOrBuilder.java new file mode 100644 index 000000000..ac992a241 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/OutputDomainProtoOrBuilder.java @@ -0,0 +1,42 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface OutputDomainProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.OutputDomainProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + boolean hasSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + com.google.protobuf.Any getSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + */ + com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/OutputFactoryProto.java b/Core/src/main/java/org/tribuo/protos/core/OutputFactoryProto.java new file mode 100644 index 000000000..83abc9d83 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/OutputFactoryProto.java @@ -0,0 +1,819 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Output Factory redirection proto
+ * 
+ * + * Protobuf type {@code tribuo.core.OutputFactoryProto} + */ +public final class OutputFactoryProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.OutputFactoryProto) + OutputFactoryProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use OutputFactoryProto.newBuilder() to construct. + private OutputFactoryProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private OutputFactoryProto() { + className_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new OutputFactoryProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private OutputFactoryProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + com.google.protobuf.Any.Builder subBuilder = null; + if (serializedData_ != null) { + subBuilder = serializedData_.toBuilder(); + } + serializedData_ = input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(serializedData_); + serializedData_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputFactoryProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputFactoryProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.OutputFactoryProto.class, org.tribuo.protos.core.OutputFactoryProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERIALIZED_DATA_FIELD_NUMBER = 3; + private com.google.protobuf.Any serializedData_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + @java.lang.Override + public boolean hasSerializedData() { + return serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + @java.lang.Override + public com.google.protobuf.Any getSerializedData() { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + @java.lang.Override + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + return getSerializedData(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (serializedData_ != null) { + output.writeMessage(3, getSerializedData()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (serializedData_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getSerializedData()); + } + 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 org.tribuo.protos.core.OutputFactoryProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.OutputFactoryProto other = (org.tribuo.protos.core.OutputFactoryProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasSerializedData() != other.hasSerializedData()) return false; + if (hasSerializedData()) { + if (!getSerializedData() + .equals(other.getSerializedData())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasSerializedData()) { + hash = (37 * hash) + SERIALIZED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getSerializedData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.OutputFactoryProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.OutputFactoryProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.OutputFactoryProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.OutputFactoryProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.OutputFactoryProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.OutputFactoryProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.OutputFactoryProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.OutputFactoryProto 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 org.tribuo.protos.core.OutputFactoryProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.OutputFactoryProto 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 org.tribuo.protos.core.OutputFactoryProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.OutputFactoryProto 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(org.tribuo.protos.core.OutputFactoryProto 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; + } + /** + *
+   *Output Factory redirection proto
+   * 
+ * + * Protobuf type {@code tribuo.core.OutputFactoryProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.OutputFactoryProto) + org.tribuo.protos.core.OutputFactoryProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputFactoryProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputFactoryProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.OutputFactoryProto.class, org.tribuo.protos.core.OutputFactoryProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.OutputFactoryProto.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(); + version_ = 0; + + className_ = ""; + + if (serializedDataBuilder_ == null) { + serializedData_ = null; + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputFactoryProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.OutputFactoryProto getDefaultInstanceForType() { + return org.tribuo.protos.core.OutputFactoryProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.OutputFactoryProto build() { + org.tribuo.protos.core.OutputFactoryProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.OutputFactoryProto buildPartial() { + org.tribuo.protos.core.OutputFactoryProto result = new org.tribuo.protos.core.OutputFactoryProto(this); + result.version_ = version_; + result.className_ = className_; + if (serializedDataBuilder_ == null) { + result.serializedData_ = serializedData_; + } else { + result.serializedData_ = serializedDataBuilder_.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 org.tribuo.protos.core.OutputFactoryProto) { + return mergeFrom((org.tribuo.protos.core.OutputFactoryProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.OutputFactoryProto other) { + if (other == org.tribuo.protos.core.OutputFactoryProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasSerializedData()) { + mergeSerializedData(other.getSerializedData()); + } + 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 { + org.tribuo.protos.core.OutputFactoryProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.OutputFactoryProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Any serializedData_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> serializedDataBuilder_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + public boolean hasSerializedData() { + return serializedDataBuilder_ != null || serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + public com.google.protobuf.Any getSerializedData() { + if (serializedDataBuilder_ == null) { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } else { + return serializedDataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + serializedData_ = value; + onChanged(); + } else { + serializedDataBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData( + com.google.protobuf.Any.Builder builderForValue) { + if (serializedDataBuilder_ == null) { + serializedData_ = builderForValue.build(); + onChanged(); + } else { + serializedDataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder mergeSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (serializedData_ != null) { + serializedData_ = + com.google.protobuf.Any.newBuilder(serializedData_).mergeFrom(value).buildPartial(); + } else { + serializedData_ = value; + } + onChanged(); + } else { + serializedDataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder clearSerializedData() { + if (serializedDataBuilder_ == null) { + serializedData_ = null; + onChanged(); + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.Any.Builder getSerializedDataBuilder() { + + onChanged(); + return getSerializedDataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + if (serializedDataBuilder_ != null) { + return serializedDataBuilder_.getMessageOrBuilder(); + } else { + return serializedData_ == null ? + com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> + getSerializedDataFieldBuilder() { + if (serializedDataBuilder_ == null) { + serializedDataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( + getSerializedData(), + getParentForChildren(), + isClean()); + serializedData_ = null; + } + return serializedDataBuilder_; + } + @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:tribuo.core.OutputFactoryProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.OutputFactoryProto) + private static final org.tribuo.protos.core.OutputFactoryProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.OutputFactoryProto(); + } + + public static org.tribuo.protos.core.OutputFactoryProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OutputFactoryProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new OutputFactoryProto(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 org.tribuo.protos.core.OutputFactoryProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/OutputFactoryProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/OutputFactoryProtoOrBuilder.java new file mode 100644 index 000000000..76c059484 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/OutputFactoryProtoOrBuilder.java @@ -0,0 +1,42 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface OutputFactoryProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.OutputFactoryProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + boolean hasSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + com.google.protobuf.Any getSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + */ + com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/OutputProto.java b/Core/src/main/java/org/tribuo/protos/core/OutputProto.java new file mode 100644 index 000000000..14ef48f45 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/OutputProto.java @@ -0,0 +1,819 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Output redirection proto
+ * 
+ * + * Protobuf type {@code tribuo.core.OutputProto} + */ +public final class OutputProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.OutputProto) + OutputProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use OutputProto.newBuilder() to construct. + private OutputProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private OutputProto() { + className_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new OutputProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private OutputProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + com.google.protobuf.Any.Builder subBuilder = null; + if (serializedData_ != null) { + subBuilder = serializedData_.toBuilder(); + } + serializedData_ = input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(serializedData_); + serializedData_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.OutputProto.class, org.tribuo.protos.core.OutputProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERIALIZED_DATA_FIELD_NUMBER = 3; + private com.google.protobuf.Any serializedData_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + @java.lang.Override + public boolean hasSerializedData() { + return serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + @java.lang.Override + public com.google.protobuf.Any getSerializedData() { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + @java.lang.Override + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + return getSerializedData(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (serializedData_ != null) { + output.writeMessage(3, getSerializedData()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (serializedData_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getSerializedData()); + } + 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 org.tribuo.protos.core.OutputProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.OutputProto other = (org.tribuo.protos.core.OutputProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasSerializedData() != other.hasSerializedData()) return false; + if (hasSerializedData()) { + if (!getSerializedData() + .equals(other.getSerializedData())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasSerializedData()) { + hash = (37 * hash) + SERIALIZED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getSerializedData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.OutputProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.OutputProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.OutputProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.OutputProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.OutputProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.OutputProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.OutputProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.OutputProto 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 org.tribuo.protos.core.OutputProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.OutputProto 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 org.tribuo.protos.core.OutputProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.OutputProto 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(org.tribuo.protos.core.OutputProto 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; + } + /** + *
+   *Output redirection proto
+   * 
+ * + * Protobuf type {@code tribuo.core.OutputProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.OutputProto) + org.tribuo.protos.core.OutputProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.OutputProto.class, org.tribuo.protos.core.OutputProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.OutputProto.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(); + version_ = 0; + + className_ = ""; + + if (serializedDataBuilder_ == null) { + serializedData_ = null; + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_OutputProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.OutputProto getDefaultInstanceForType() { + return org.tribuo.protos.core.OutputProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.OutputProto build() { + org.tribuo.protos.core.OutputProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.OutputProto buildPartial() { + org.tribuo.protos.core.OutputProto result = new org.tribuo.protos.core.OutputProto(this); + result.version_ = version_; + result.className_ = className_; + if (serializedDataBuilder_ == null) { + result.serializedData_ = serializedData_; + } else { + result.serializedData_ = serializedDataBuilder_.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 org.tribuo.protos.core.OutputProto) { + return mergeFrom((org.tribuo.protos.core.OutputProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.OutputProto other) { + if (other == org.tribuo.protos.core.OutputProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasSerializedData()) { + mergeSerializedData(other.getSerializedData()); + } + 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 { + org.tribuo.protos.core.OutputProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.OutputProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Any serializedData_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> serializedDataBuilder_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + public boolean hasSerializedData() { + return serializedDataBuilder_ != null || serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + public com.google.protobuf.Any getSerializedData() { + if (serializedDataBuilder_ == null) { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } else { + return serializedDataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + serializedData_ = value; + onChanged(); + } else { + serializedDataBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData( + com.google.protobuf.Any.Builder builderForValue) { + if (serializedDataBuilder_ == null) { + serializedData_ = builderForValue.build(); + onChanged(); + } else { + serializedDataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder mergeSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (serializedData_ != null) { + serializedData_ = + com.google.protobuf.Any.newBuilder(serializedData_).mergeFrom(value).buildPartial(); + } else { + serializedData_ = value; + } + onChanged(); + } else { + serializedDataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder clearSerializedData() { + if (serializedDataBuilder_ == null) { + serializedData_ = null; + onChanged(); + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.Any.Builder getSerializedDataBuilder() { + + onChanged(); + return getSerializedDataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + if (serializedDataBuilder_ != null) { + return serializedDataBuilder_.getMessageOrBuilder(); + } else { + return serializedData_ == null ? + com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> + getSerializedDataFieldBuilder() { + if (serializedDataBuilder_ == null) { + serializedDataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( + getSerializedData(), + getParentForChildren(), + isClean()); + serializedData_ = null; + } + return serializedDataBuilder_; + } + @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:tribuo.core.OutputProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.OutputProto) + private static final org.tribuo.protos.core.OutputProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.OutputProto(); + } + + public static org.tribuo.protos.core.OutputProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OutputProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new OutputProto(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 org.tribuo.protos.core.OutputProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/OutputProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/OutputProtoOrBuilder.java new file mode 100644 index 000000000..aad78275b --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/OutputProtoOrBuilder.java @@ -0,0 +1,42 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface OutputProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.OutputProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + boolean hasSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + com.google.protobuf.Any getSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + */ + com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/PredictionProto.java b/Core/src/main/java/org/tribuo/protos/core/PredictionProto.java new file mode 100644 index 000000000..48165e096 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/PredictionProto.java @@ -0,0 +1,1489 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Prediction proto
+ * 
+ * + * Protobuf type {@code tribuo.core.PredictionProto} + */ +public final class PredictionProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.PredictionProto) + PredictionProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use PredictionProto.newBuilder() to construct. + private PredictionProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private PredictionProto() { + className_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new PredictionProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private PredictionProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + org.tribuo.protos.core.ExampleProto.Builder subBuilder = null; + if (example_ != null) { + subBuilder = example_.toBuilder(); + } + example_ = input.readMessage(org.tribuo.protos.core.ExampleProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(example_); + example_ = subBuilder.buildPartial(); + } + + break; + } + case 34: { + org.tribuo.protos.core.OutputProto.Builder subBuilder = null; + if (output_ != null) { + subBuilder = output_.toBuilder(); + } + output_ = input.readMessage(org.tribuo.protos.core.OutputProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(output_); + output_ = subBuilder.buildPartial(); + } + + break; + } + case 40: { + + probability_ = input.readBool(); + break; + } + case 48: { + + numUsed_ = input.readInt32(); + break; + } + case 56: { + + exampleSize_ = input.readInt32(); + break; + } + case 66: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + outputScores_ = com.google.protobuf.MapField.newMapField( + OutputScoresDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry + outputScores__ = input.readMessage( + OutputScoresDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + outputScores_.getMutableMap().put( + outputScores__.getKey(), outputScores__.getValue()); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_PredictionProto_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 8: + return internalGetOutputScores(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_PredictionProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.PredictionProto.class, org.tribuo.protos.core.PredictionProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int EXAMPLE_FIELD_NUMBER = 3; + private org.tribuo.protos.core.ExampleProto example_; + /** + * .tribuo.core.ExampleProto example = 3; + * @return Whether the example field is set. + */ + @java.lang.Override + public boolean hasExample() { + return example_ != null; + } + /** + * .tribuo.core.ExampleProto example = 3; + * @return The example. + */ + @java.lang.Override + public org.tribuo.protos.core.ExampleProto getExample() { + return example_ == null ? org.tribuo.protos.core.ExampleProto.getDefaultInstance() : example_; + } + /** + * .tribuo.core.ExampleProto example = 3; + */ + @java.lang.Override + public org.tribuo.protos.core.ExampleProtoOrBuilder getExampleOrBuilder() { + return getExample(); + } + + public static final int OUTPUT_FIELD_NUMBER = 4; + private org.tribuo.protos.core.OutputProto output_; + /** + * .tribuo.core.OutputProto output = 4; + * @return Whether the output field is set. + */ + @java.lang.Override + public boolean hasOutput() { + return output_ != null; + } + /** + * .tribuo.core.OutputProto output = 4; + * @return The output. + */ + @java.lang.Override + public org.tribuo.protos.core.OutputProto getOutput() { + return output_ == null ? org.tribuo.protos.core.OutputProto.getDefaultInstance() : output_; + } + /** + * .tribuo.core.OutputProto output = 4; + */ + @java.lang.Override + public org.tribuo.protos.core.OutputProtoOrBuilder getOutputOrBuilder() { + return getOutput(); + } + + public static final int PROBABILITY_FIELD_NUMBER = 5; + private boolean probability_; + /** + * bool probability = 5; + * @return The probability. + */ + @java.lang.Override + public boolean getProbability() { + return probability_; + } + + public static final int NUM_USED_FIELD_NUMBER = 6; + private int numUsed_; + /** + * int32 num_used = 6; + * @return The numUsed. + */ + @java.lang.Override + public int getNumUsed() { + return numUsed_; + } + + public static final int EXAMPLE_SIZE_FIELD_NUMBER = 7; + private int exampleSize_; + /** + * int32 example_size = 7; + * @return The exampleSize. + */ + @java.lang.Override + public int getExampleSize() { + return exampleSize_; + } + + public static final int OUTPUT_SCORES_FIELD_NUMBER = 8; + private static final class OutputScoresDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, org.tribuo.protos.core.OutputProto> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_PredictionProto_OutputScoresEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + org.tribuo.protos.core.OutputProto.getDefaultInstance()); + } + private com.google.protobuf.MapField< + java.lang.String, org.tribuo.protos.core.OutputProto> outputScores_; + private com.google.protobuf.MapField + internalGetOutputScores() { + if (outputScores_ == null) { + return com.google.protobuf.MapField.emptyMapField( + OutputScoresDefaultEntryHolder.defaultEntry); + } + return outputScores_; + } + + public int getOutputScoresCount() { + return internalGetOutputScores().getMap().size(); + } + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + + @java.lang.Override + public boolean containsOutputScores( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetOutputScores().getMap().containsKey(key); + } + /** + * Use {@link #getOutputScoresMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getOutputScores() { + return getOutputScoresMap(); + } + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + @java.lang.Override + + public java.util.Map getOutputScoresMap() { + return internalGetOutputScores().getMap(); + } + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + @java.lang.Override + + public org.tribuo.protos.core.OutputProto getOutputScoresOrDefault( + java.lang.String key, + org.tribuo.protos.core.OutputProto defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetOutputScores().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + @java.lang.Override + + public org.tribuo.protos.core.OutputProto getOutputScoresOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetOutputScores().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 { + if (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (example_ != null) { + output.writeMessage(3, getExample()); + } + if (output_ != null) { + output.writeMessage(4, getOutput()); + } + if (probability_ != false) { + output.writeBool(5, probability_); + } + if (numUsed_ != 0) { + output.writeInt32(6, numUsed_); + } + if (exampleSize_ != 0) { + output.writeInt32(7, exampleSize_); + } + com.google.protobuf.GeneratedMessageV3 + .serializeStringMapTo( + output, + internalGetOutputScores(), + OutputScoresDefaultEntryHolder.defaultEntry, + 8); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (example_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getExample()); + } + if (output_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getOutput()); + } + if (probability_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(5, probability_); + } + if (numUsed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, numUsed_); + } + if (exampleSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, exampleSize_); + } + for (java.util.Map.Entry entry + : internalGetOutputScores().getMap().entrySet()) { + com.google.protobuf.MapEntry + outputScores__ = OutputScoresDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, outputScores__); + } + 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 org.tribuo.protos.core.PredictionProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.PredictionProto other = (org.tribuo.protos.core.PredictionProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasExample() != other.hasExample()) return false; + if (hasExample()) { + if (!getExample() + .equals(other.getExample())) return false; + } + if (hasOutput() != other.hasOutput()) return false; + if (hasOutput()) { + if (!getOutput() + .equals(other.getOutput())) return false; + } + if (getProbability() + != other.getProbability()) return false; + if (getNumUsed() + != other.getNumUsed()) return false; + if (getExampleSize() + != other.getExampleSize()) return false; + if (!internalGetOutputScores().equals( + other.internalGetOutputScores())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasExample()) { + hash = (37 * hash) + EXAMPLE_FIELD_NUMBER; + hash = (53 * hash) + getExample().hashCode(); + } + if (hasOutput()) { + hash = (37 * hash) + OUTPUT_FIELD_NUMBER; + hash = (53 * hash) + getOutput().hashCode(); + } + hash = (37 * hash) + PROBABILITY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getProbability()); + hash = (37 * hash) + NUM_USED_FIELD_NUMBER; + hash = (53 * hash) + getNumUsed(); + hash = (37 * hash) + EXAMPLE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getExampleSize(); + if (!internalGetOutputScores().getMap().isEmpty()) { + hash = (37 * hash) + OUTPUT_SCORES_FIELD_NUMBER; + hash = (53 * hash) + internalGetOutputScores().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.PredictionProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.PredictionProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.PredictionProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.PredictionProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.PredictionProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.PredictionProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.PredictionProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.PredictionProto 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 org.tribuo.protos.core.PredictionProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.PredictionProto 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 org.tribuo.protos.core.PredictionProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.PredictionProto 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(org.tribuo.protos.core.PredictionProto 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; + } + /** + *
+   *Prediction proto
+   * 
+ * + * Protobuf type {@code tribuo.core.PredictionProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.PredictionProto) + org.tribuo.protos.core.PredictionProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_PredictionProto_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 8: + return internalGetOutputScores(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField( + int number) { + switch (number) { + case 8: + return internalGetMutableOutputScores(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_PredictionProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.PredictionProto.class, org.tribuo.protos.core.PredictionProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.PredictionProto.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(); + version_ = 0; + + className_ = ""; + + if (exampleBuilder_ == null) { + example_ = null; + } else { + example_ = null; + exampleBuilder_ = null; + } + if (outputBuilder_ == null) { + output_ = null; + } else { + output_ = null; + outputBuilder_ = null; + } + probability_ = false; + + numUsed_ = 0; + + exampleSize_ = 0; + + internalGetMutableOutputScores().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_PredictionProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.PredictionProto getDefaultInstanceForType() { + return org.tribuo.protos.core.PredictionProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.PredictionProto build() { + org.tribuo.protos.core.PredictionProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.PredictionProto buildPartial() { + org.tribuo.protos.core.PredictionProto result = new org.tribuo.protos.core.PredictionProto(this); + int from_bitField0_ = bitField0_; + result.version_ = version_; + result.className_ = className_; + if (exampleBuilder_ == null) { + result.example_ = example_; + } else { + result.example_ = exampleBuilder_.build(); + } + if (outputBuilder_ == null) { + result.output_ = output_; + } else { + result.output_ = outputBuilder_.build(); + } + result.probability_ = probability_; + result.numUsed_ = numUsed_; + result.exampleSize_ = exampleSize_; + result.outputScores_ = internalGetOutputScores(); + result.outputScores_.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 org.tribuo.protos.core.PredictionProto) { + return mergeFrom((org.tribuo.protos.core.PredictionProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.PredictionProto other) { + if (other == org.tribuo.protos.core.PredictionProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasExample()) { + mergeExample(other.getExample()); + } + if (other.hasOutput()) { + mergeOutput(other.getOutput()); + } + if (other.getProbability() != false) { + setProbability(other.getProbability()); + } + if (other.getNumUsed() != 0) { + setNumUsed(other.getNumUsed()); + } + if (other.getExampleSize() != 0) { + setExampleSize(other.getExampleSize()); + } + internalGetMutableOutputScores().mergeFrom( + other.internalGetOutputScores()); + 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 { + org.tribuo.protos.core.PredictionProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.PredictionProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private org.tribuo.protos.core.ExampleProto example_; + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.ExampleProto, org.tribuo.protos.core.ExampleProto.Builder, org.tribuo.protos.core.ExampleProtoOrBuilder> exampleBuilder_; + /** + * .tribuo.core.ExampleProto example = 3; + * @return Whether the example field is set. + */ + public boolean hasExample() { + return exampleBuilder_ != null || example_ != null; + } + /** + * .tribuo.core.ExampleProto example = 3; + * @return The example. + */ + public org.tribuo.protos.core.ExampleProto getExample() { + if (exampleBuilder_ == null) { + return example_ == null ? org.tribuo.protos.core.ExampleProto.getDefaultInstance() : example_; + } else { + return exampleBuilder_.getMessage(); + } + } + /** + * .tribuo.core.ExampleProto example = 3; + */ + public Builder setExample(org.tribuo.protos.core.ExampleProto value) { + if (exampleBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + example_ = value; + onChanged(); + } else { + exampleBuilder_.setMessage(value); + } + + return this; + } + /** + * .tribuo.core.ExampleProto example = 3; + */ + public Builder setExample( + org.tribuo.protos.core.ExampleProto.Builder builderForValue) { + if (exampleBuilder_ == null) { + example_ = builderForValue.build(); + onChanged(); + } else { + exampleBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .tribuo.core.ExampleProto example = 3; + */ + public Builder mergeExample(org.tribuo.protos.core.ExampleProto value) { + if (exampleBuilder_ == null) { + if (example_ != null) { + example_ = + org.tribuo.protos.core.ExampleProto.newBuilder(example_).mergeFrom(value).buildPartial(); + } else { + example_ = value; + } + onChanged(); + } else { + exampleBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .tribuo.core.ExampleProto example = 3; + */ + public Builder clearExample() { + if (exampleBuilder_ == null) { + example_ = null; + onChanged(); + } else { + example_ = null; + exampleBuilder_ = null; + } + + return this; + } + /** + * .tribuo.core.ExampleProto example = 3; + */ + public org.tribuo.protos.core.ExampleProto.Builder getExampleBuilder() { + + onChanged(); + return getExampleFieldBuilder().getBuilder(); + } + /** + * .tribuo.core.ExampleProto example = 3; + */ + public org.tribuo.protos.core.ExampleProtoOrBuilder getExampleOrBuilder() { + if (exampleBuilder_ != null) { + return exampleBuilder_.getMessageOrBuilder(); + } else { + return example_ == null ? + org.tribuo.protos.core.ExampleProto.getDefaultInstance() : example_; + } + } + /** + * .tribuo.core.ExampleProto example = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.ExampleProto, org.tribuo.protos.core.ExampleProto.Builder, org.tribuo.protos.core.ExampleProtoOrBuilder> + getExampleFieldBuilder() { + if (exampleBuilder_ == null) { + exampleBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.ExampleProto, org.tribuo.protos.core.ExampleProto.Builder, org.tribuo.protos.core.ExampleProtoOrBuilder>( + getExample(), + getParentForChildren(), + isClean()); + example_ = null; + } + return exampleBuilder_; + } + + private org.tribuo.protos.core.OutputProto output_; + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputProto, org.tribuo.protos.core.OutputProto.Builder, org.tribuo.protos.core.OutputProtoOrBuilder> outputBuilder_; + /** + * .tribuo.core.OutputProto output = 4; + * @return Whether the output field is set. + */ + public boolean hasOutput() { + return outputBuilder_ != null || output_ != null; + } + /** + * .tribuo.core.OutputProto output = 4; + * @return The output. + */ + public org.tribuo.protos.core.OutputProto getOutput() { + if (outputBuilder_ == null) { + return output_ == null ? org.tribuo.protos.core.OutputProto.getDefaultInstance() : output_; + } else { + return outputBuilder_.getMessage(); + } + } + /** + * .tribuo.core.OutputProto output = 4; + */ + public Builder setOutput(org.tribuo.protos.core.OutputProto value) { + if (outputBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + output_ = value; + onChanged(); + } else { + outputBuilder_.setMessage(value); + } + + return this; + } + /** + * .tribuo.core.OutputProto output = 4; + */ + public Builder setOutput( + org.tribuo.protos.core.OutputProto.Builder builderForValue) { + if (outputBuilder_ == null) { + output_ = builderForValue.build(); + onChanged(); + } else { + outputBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .tribuo.core.OutputProto output = 4; + */ + public Builder mergeOutput(org.tribuo.protos.core.OutputProto value) { + if (outputBuilder_ == null) { + if (output_ != null) { + output_ = + org.tribuo.protos.core.OutputProto.newBuilder(output_).mergeFrom(value).buildPartial(); + } else { + output_ = value; + } + onChanged(); + } else { + outputBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .tribuo.core.OutputProto output = 4; + */ + public Builder clearOutput() { + if (outputBuilder_ == null) { + output_ = null; + onChanged(); + } else { + output_ = null; + outputBuilder_ = null; + } + + return this; + } + /** + * .tribuo.core.OutputProto output = 4; + */ + public org.tribuo.protos.core.OutputProto.Builder getOutputBuilder() { + + onChanged(); + return getOutputFieldBuilder().getBuilder(); + } + /** + * .tribuo.core.OutputProto output = 4; + */ + public org.tribuo.protos.core.OutputProtoOrBuilder getOutputOrBuilder() { + if (outputBuilder_ != null) { + return outputBuilder_.getMessageOrBuilder(); + } else { + return output_ == null ? + org.tribuo.protos.core.OutputProto.getDefaultInstance() : output_; + } + } + /** + * .tribuo.core.OutputProto output = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputProto, org.tribuo.protos.core.OutputProto.Builder, org.tribuo.protos.core.OutputProtoOrBuilder> + getOutputFieldBuilder() { + if (outputBuilder_ == null) { + outputBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + org.tribuo.protos.core.OutputProto, org.tribuo.protos.core.OutputProto.Builder, org.tribuo.protos.core.OutputProtoOrBuilder>( + getOutput(), + getParentForChildren(), + isClean()); + output_ = null; + } + return outputBuilder_; + } + + private boolean probability_ ; + /** + * bool probability = 5; + * @return The probability. + */ + @java.lang.Override + public boolean getProbability() { + return probability_; + } + /** + * bool probability = 5; + * @param value The probability to set. + * @return This builder for chaining. + */ + public Builder setProbability(boolean value) { + + probability_ = value; + onChanged(); + return this; + } + /** + * bool probability = 5; + * @return This builder for chaining. + */ + public Builder clearProbability() { + + probability_ = false; + onChanged(); + return this; + } + + private int numUsed_ ; + /** + * int32 num_used = 6; + * @return The numUsed. + */ + @java.lang.Override + public int getNumUsed() { + return numUsed_; + } + /** + * int32 num_used = 6; + * @param value The numUsed to set. + * @return This builder for chaining. + */ + public Builder setNumUsed(int value) { + + numUsed_ = value; + onChanged(); + return this; + } + /** + * int32 num_used = 6; + * @return This builder for chaining. + */ + public Builder clearNumUsed() { + + numUsed_ = 0; + onChanged(); + return this; + } + + private int exampleSize_ ; + /** + * int32 example_size = 7; + * @return The exampleSize. + */ + @java.lang.Override + public int getExampleSize() { + return exampleSize_; + } + /** + * int32 example_size = 7; + * @param value The exampleSize to set. + * @return This builder for chaining. + */ + public Builder setExampleSize(int value) { + + exampleSize_ = value; + onChanged(); + return this; + } + /** + * int32 example_size = 7; + * @return This builder for chaining. + */ + public Builder clearExampleSize() { + + exampleSize_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, org.tribuo.protos.core.OutputProto> outputScores_; + private com.google.protobuf.MapField + internalGetOutputScores() { + if (outputScores_ == null) { + return com.google.protobuf.MapField.emptyMapField( + OutputScoresDefaultEntryHolder.defaultEntry); + } + return outputScores_; + } + private com.google.protobuf.MapField + internalGetMutableOutputScores() { + onChanged();; + if (outputScores_ == null) { + outputScores_ = com.google.protobuf.MapField.newMapField( + OutputScoresDefaultEntryHolder.defaultEntry); + } + if (!outputScores_.isMutable()) { + outputScores_ = outputScores_.copy(); + } + return outputScores_; + } + + public int getOutputScoresCount() { + return internalGetOutputScores().getMap().size(); + } + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + + @java.lang.Override + public boolean containsOutputScores( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetOutputScores().getMap().containsKey(key); + } + /** + * Use {@link #getOutputScoresMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getOutputScores() { + return getOutputScoresMap(); + } + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + @java.lang.Override + + public java.util.Map getOutputScoresMap() { + return internalGetOutputScores().getMap(); + } + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + @java.lang.Override + + public org.tribuo.protos.core.OutputProto getOutputScoresOrDefault( + java.lang.String key, + org.tribuo.protos.core.OutputProto defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetOutputScores().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + @java.lang.Override + + public org.tribuo.protos.core.OutputProto getOutputScoresOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetOutputScores().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearOutputScores() { + internalGetMutableOutputScores().getMutableMap() + .clear(); + return this; + } + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + + public Builder removeOutputScores( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableOutputScores().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableOutputScores() { + return internalGetMutableOutputScores().getMutableMap(); + } + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + public Builder putOutputScores( + java.lang.String key, + org.tribuo.protos.core.OutputProto value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { + throw new NullPointerException("map value"); +} + + internalGetMutableOutputScores().getMutableMap() + .put(key, value); + return this; + } + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + + public Builder putAllOutputScores( + java.util.Map values) { + internalGetMutableOutputScores().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:tribuo.core.PredictionProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.PredictionProto) + private static final org.tribuo.protos.core.PredictionProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.PredictionProto(); + } + + public static org.tribuo.protos.core.PredictionProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PredictionProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PredictionProto(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 org.tribuo.protos.core.PredictionProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/PredictionProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/PredictionProtoOrBuilder.java new file mode 100644 index 000000000..459f97342 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/PredictionProtoOrBuilder.java @@ -0,0 +1,111 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface PredictionProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.PredictionProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .tribuo.core.ExampleProto example = 3; + * @return Whether the example field is set. + */ + boolean hasExample(); + /** + * .tribuo.core.ExampleProto example = 3; + * @return The example. + */ + org.tribuo.protos.core.ExampleProto getExample(); + /** + * .tribuo.core.ExampleProto example = 3; + */ + org.tribuo.protos.core.ExampleProtoOrBuilder getExampleOrBuilder(); + + /** + * .tribuo.core.OutputProto output = 4; + * @return Whether the output field is set. + */ + boolean hasOutput(); + /** + * .tribuo.core.OutputProto output = 4; + * @return The output. + */ + org.tribuo.protos.core.OutputProto getOutput(); + /** + * .tribuo.core.OutputProto output = 4; + */ + org.tribuo.protos.core.OutputProtoOrBuilder getOutputOrBuilder(); + + /** + * bool probability = 5; + * @return The probability. + */ + boolean getProbability(); + + /** + * int32 num_used = 6; + * @return The numUsed. + */ + int getNumUsed(); + + /** + * int32 example_size = 7; + * @return The exampleSize. + */ + int getExampleSize(); + + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + int getOutputScoresCount(); + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + boolean containsOutputScores( + java.lang.String key); + /** + * Use {@link #getOutputScoresMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getOutputScores(); + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + java.util.Map + getOutputScoresMap(); + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + + /* nullable */ +org.tribuo.protos.core.OutputProto getOutputScoresOrDefault( + java.lang.String key, + /* nullable */ +org.tribuo.protos.core.OutputProto defaultValue); + /** + * map<string, .tribuo.core.OutputProto> output_scores = 8; + */ + + org.tribuo.protos.core.OutputProto getOutputScoresOrThrow( + java.lang.String key); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/RealIDInfoProto.java b/Core/src/main/java/org/tribuo/protos/core/RealIDInfoProto.java new file mode 100644 index 000000000..3331d742f --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/RealIDInfoProto.java @@ -0,0 +1,959 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *RealIDInfo proto
+ * 
+ * + * Protobuf type {@code tribuo.core.RealIDInfoProto} + */ +public final class RealIDInfoProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.RealIDInfoProto) + RealIDInfoProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use RealIDInfoProto.newBuilder() to construct. + private RealIDInfoProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private RealIDInfoProto() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new RealIDInfoProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private RealIDInfoProto( + 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 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 16: { + + count_ = input.readInt32(); + break; + } + case 24: { + + id_ = input.readInt32(); + break; + } + case 81: { + + max_ = input.readDouble(); + break; + } + case 89: { + + min_ = input.readDouble(); + break; + } + case 97: { + + mean_ = input.readDouble(); + break; + } + case 105: { + + sumSquares_ = input.readDouble(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_RealIDInfoProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_RealIDInfoProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.RealIDInfoProto.class, org.tribuo.protos.core.RealIDInfoProto.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * string name = 1; + * @return The name. + */ + @java.lang.Override + 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 = 1; + * @return The bytes for name. + */ + @java.lang.Override + 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; + } + } + + public static final int COUNT_FIELD_NUMBER = 2; + private int count_; + /** + * int32 count = 2; + * @return The count. + */ + @java.lang.Override + public int getCount() { + return count_; + } + + public static final int ID_FIELD_NUMBER = 3; + private int id_; + /** + * int32 id = 3; + * @return The id. + */ + @java.lang.Override + public int getId() { + return id_; + } + + public static final int MAX_FIELD_NUMBER = 10; + private double max_; + /** + * double max = 10; + * @return The max. + */ + @java.lang.Override + public double getMax() { + return max_; + } + + public static final int MIN_FIELD_NUMBER = 11; + private double min_; + /** + * double min = 11; + * @return The min. + */ + @java.lang.Override + public double getMin() { + return min_; + } + + public static final int MEAN_FIELD_NUMBER = 12; + private double mean_; + /** + * double mean = 12; + * @return The mean. + */ + @java.lang.Override + public double getMean() { + return mean_; + } + + public static final int SUMSQUARES_FIELD_NUMBER = 13; + private double sumSquares_; + /** + * double sumSquares = 13; + * @return The sumSquares. + */ + @java.lang.Override + public double getSumSquares() { + return sumSquares_; + } + + 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (count_ != 0) { + output.writeInt32(2, count_); + } + if (id_ != 0) { + output.writeInt32(3, id_); + } + if (java.lang.Double.doubleToRawLongBits(max_) != 0) { + output.writeDouble(10, max_); + } + if (java.lang.Double.doubleToRawLongBits(min_) != 0) { + output.writeDouble(11, min_); + } + if (java.lang.Double.doubleToRawLongBits(mean_) != 0) { + output.writeDouble(12, mean_); + } + if (java.lang.Double.doubleToRawLongBits(sumSquares_) != 0) { + output.writeDouble(13, sumSquares_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (count_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, count_); + } + if (id_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, id_); + } + if (java.lang.Double.doubleToRawLongBits(max_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(10, max_); + } + if (java.lang.Double.doubleToRawLongBits(min_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(11, min_); + } + if (java.lang.Double.doubleToRawLongBits(mean_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(12, mean_); + } + if (java.lang.Double.doubleToRawLongBits(sumSquares_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(13, sumSquares_); + } + 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 org.tribuo.protos.core.RealIDInfoProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.RealIDInfoProto other = (org.tribuo.protos.core.RealIDInfoProto) obj; + + if (!getName() + .equals(other.getName())) return false; + if (getCount() + != other.getCount()) return false; + if (getId() + != other.getId()) return false; + if (java.lang.Double.doubleToLongBits(getMax()) + != java.lang.Double.doubleToLongBits( + other.getMax())) return false; + if (java.lang.Double.doubleToLongBits(getMin()) + != java.lang.Double.doubleToLongBits( + other.getMin())) return false; + if (java.lang.Double.doubleToLongBits(getMean()) + != java.lang.Double.doubleToLongBits( + other.getMean())) return false; + if (java.lang.Double.doubleToLongBits(getSumSquares()) + != java.lang.Double.doubleToLongBits( + other.getSumSquares())) 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) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + COUNT_FIELD_NUMBER; + hash = (53 * hash) + getCount(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId(); + hash = (37 * hash) + MAX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getMax())); + hash = (37 * hash) + MIN_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getMin())); + hash = (37 * hash) + MEAN_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getMean())); + hash = (37 * hash) + SUMSQUARES_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getSumSquares())); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.RealIDInfoProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.RealIDInfoProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.RealIDInfoProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.RealIDInfoProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.RealIDInfoProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.RealIDInfoProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.RealIDInfoProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.RealIDInfoProto 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 org.tribuo.protos.core.RealIDInfoProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.RealIDInfoProto 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 org.tribuo.protos.core.RealIDInfoProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.RealIDInfoProto 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(org.tribuo.protos.core.RealIDInfoProto 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; + } + /** + *
+   *RealIDInfo proto
+   * 
+ * + * Protobuf type {@code tribuo.core.RealIDInfoProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.RealIDInfoProto) + org.tribuo.protos.core.RealIDInfoProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_RealIDInfoProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_RealIDInfoProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.RealIDInfoProto.class, org.tribuo.protos.core.RealIDInfoProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.RealIDInfoProto.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(); + name_ = ""; + + count_ = 0; + + id_ = 0; + + max_ = 0D; + + min_ = 0D; + + mean_ = 0D; + + sumSquares_ = 0D; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_RealIDInfoProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.RealIDInfoProto getDefaultInstanceForType() { + return org.tribuo.protos.core.RealIDInfoProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.RealIDInfoProto build() { + org.tribuo.protos.core.RealIDInfoProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.RealIDInfoProto buildPartial() { + org.tribuo.protos.core.RealIDInfoProto result = new org.tribuo.protos.core.RealIDInfoProto(this); + result.name_ = name_; + result.count_ = count_; + result.id_ = id_; + result.max_ = max_; + result.min_ = min_; + result.mean_ = mean_; + result.sumSquares_ = sumSquares_; + 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 org.tribuo.protos.core.RealIDInfoProto) { + return mergeFrom((org.tribuo.protos.core.RealIDInfoProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.RealIDInfoProto other) { + if (other == org.tribuo.protos.core.RealIDInfoProto.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getCount() != 0) { + setCount(other.getCount()); + } + if (other.getId() != 0) { + setId(other.getId()); + } + if (other.getMax() != 0D) { + setMax(other.getMax()); + } + if (other.getMin() != 0D) { + setMin(other.getMin()); + } + if (other.getMean() != 0D) { + setMean(other.getMean()); + } + if (other.getSumSquares() != 0D) { + setSumSquares(other.getSumSquares()); + } + 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 { + org.tribuo.protos.core.RealIDInfoProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.RealIDInfoProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * string name = 1; + * @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 = 1; + * @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 = 1; + * @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 = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * string name = 1; + * @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; + } + + private int count_ ; + /** + * int32 count = 2; + * @return The count. + */ + @java.lang.Override + public int getCount() { + return count_; + } + /** + * int32 count = 2; + * @param value The count to set. + * @return This builder for chaining. + */ + public Builder setCount(int value) { + + count_ = value; + onChanged(); + return this; + } + /** + * int32 count = 2; + * @return This builder for chaining. + */ + public Builder clearCount() { + + count_ = 0; + onChanged(); + return this; + } + + private int id_ ; + /** + * int32 id = 3; + * @return The id. + */ + @java.lang.Override + public int getId() { + return id_; + } + /** + * int32 id = 3; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId(int value) { + + id_ = value; + onChanged(); + return this; + } + /** + * int32 id = 3; + * @return This builder for chaining. + */ + public Builder clearId() { + + id_ = 0; + onChanged(); + return this; + } + + private double max_ ; + /** + * double max = 10; + * @return The max. + */ + @java.lang.Override + public double getMax() { + return max_; + } + /** + * double max = 10; + * @param value The max to set. + * @return This builder for chaining. + */ + public Builder setMax(double value) { + + max_ = value; + onChanged(); + return this; + } + /** + * double max = 10; + * @return This builder for chaining. + */ + public Builder clearMax() { + + max_ = 0D; + onChanged(); + return this; + } + + private double min_ ; + /** + * double min = 11; + * @return The min. + */ + @java.lang.Override + public double getMin() { + return min_; + } + /** + * double min = 11; + * @param value The min to set. + * @return This builder for chaining. + */ + public Builder setMin(double value) { + + min_ = value; + onChanged(); + return this; + } + /** + * double min = 11; + * @return This builder for chaining. + */ + public Builder clearMin() { + + min_ = 0D; + onChanged(); + return this; + } + + private double mean_ ; + /** + * double mean = 12; + * @return The mean. + */ + @java.lang.Override + public double getMean() { + return mean_; + } + /** + * double mean = 12; + * @param value The mean to set. + * @return This builder for chaining. + */ + public Builder setMean(double value) { + + mean_ = value; + onChanged(); + return this; + } + /** + * double mean = 12; + * @return This builder for chaining. + */ + public Builder clearMean() { + + mean_ = 0D; + onChanged(); + return this; + } + + private double sumSquares_ ; + /** + * double sumSquares = 13; + * @return The sumSquares. + */ + @java.lang.Override + public double getSumSquares() { + return sumSquares_; + } + /** + * double sumSquares = 13; + * @param value The sumSquares to set. + * @return This builder for chaining. + */ + public Builder setSumSquares(double value) { + + sumSquares_ = value; + onChanged(); + return this; + } + /** + * double sumSquares = 13; + * @return This builder for chaining. + */ + public Builder clearSumSquares() { + + sumSquares_ = 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:tribuo.core.RealIDInfoProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.RealIDInfoProto) + private static final org.tribuo.protos.core.RealIDInfoProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.RealIDInfoProto(); + } + + public static org.tribuo.protos.core.RealIDInfoProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RealIDInfoProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RealIDInfoProto(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 org.tribuo.protos.core.RealIDInfoProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/RealIDInfoProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/RealIDInfoProtoOrBuilder.java new file mode 100644 index 000000000..6d04c4dff --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/RealIDInfoProtoOrBuilder.java @@ -0,0 +1,57 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface RealIDInfoProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.RealIDInfoProto) + com.google.protobuf.MessageOrBuilder { + + /** + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + * int32 count = 2; + * @return The count. + */ + int getCount(); + + /** + * int32 id = 3; + * @return The id. + */ + int getId(); + + /** + * double max = 10; + * @return The max. + */ + double getMax(); + + /** + * double min = 11; + * @return The min. + */ + double getMin(); + + /** + * double mean = 12; + * @return The mean. + */ + double getMean(); + + /** + * double sumSquares = 13; + * @return The sumSquares. + */ + double getSumSquares(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/RealInfoProto.java b/Core/src/main/java/org/tribuo/protos/core/RealInfoProto.java new file mode 100644 index 000000000..eeb998bf8 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/RealInfoProto.java @@ -0,0 +1,895 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *RealInfo proto
+ * 
+ * + * Protobuf type {@code tribuo.core.RealInfoProto} + */ +public final class RealInfoProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.RealInfoProto) + RealInfoProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use RealInfoProto.newBuilder() to construct. + private RealInfoProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private RealInfoProto() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new RealInfoProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private RealInfoProto( + 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 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 16: { + + count_ = input.readInt32(); + break; + } + case 81: { + + max_ = input.readDouble(); + break; + } + case 89: { + + min_ = input.readDouble(); + break; + } + case 97: { + + mean_ = input.readDouble(); + break; + } + case 105: { + + sumSquares_ = input.readDouble(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_RealInfoProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_RealInfoProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.RealInfoProto.class, org.tribuo.protos.core.RealInfoProto.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * string name = 1; + * @return The name. + */ + @java.lang.Override + 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 = 1; + * @return The bytes for name. + */ + @java.lang.Override + 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; + } + } + + public static final int COUNT_FIELD_NUMBER = 2; + private int count_; + /** + * int32 count = 2; + * @return The count. + */ + @java.lang.Override + public int getCount() { + return count_; + } + + public static final int MAX_FIELD_NUMBER = 10; + private double max_; + /** + * double max = 10; + * @return The max. + */ + @java.lang.Override + public double getMax() { + return max_; + } + + public static final int MIN_FIELD_NUMBER = 11; + private double min_; + /** + * double min = 11; + * @return The min. + */ + @java.lang.Override + public double getMin() { + return min_; + } + + public static final int MEAN_FIELD_NUMBER = 12; + private double mean_; + /** + * double mean = 12; + * @return The mean. + */ + @java.lang.Override + public double getMean() { + return mean_; + } + + public static final int SUMSQUARES_FIELD_NUMBER = 13; + private double sumSquares_; + /** + * double sumSquares = 13; + * @return The sumSquares. + */ + @java.lang.Override + public double getSumSquares() { + return sumSquares_; + } + + 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (count_ != 0) { + output.writeInt32(2, count_); + } + if (java.lang.Double.doubleToRawLongBits(max_) != 0) { + output.writeDouble(10, max_); + } + if (java.lang.Double.doubleToRawLongBits(min_) != 0) { + output.writeDouble(11, min_); + } + if (java.lang.Double.doubleToRawLongBits(mean_) != 0) { + output.writeDouble(12, mean_); + } + if (java.lang.Double.doubleToRawLongBits(sumSquares_) != 0) { + output.writeDouble(13, sumSquares_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (count_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, count_); + } + if (java.lang.Double.doubleToRawLongBits(max_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(10, max_); + } + if (java.lang.Double.doubleToRawLongBits(min_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(11, min_); + } + if (java.lang.Double.doubleToRawLongBits(mean_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(12, mean_); + } + if (java.lang.Double.doubleToRawLongBits(sumSquares_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(13, sumSquares_); + } + 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 org.tribuo.protos.core.RealInfoProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.RealInfoProto other = (org.tribuo.protos.core.RealInfoProto) obj; + + if (!getName() + .equals(other.getName())) return false; + if (getCount() + != other.getCount()) return false; + if (java.lang.Double.doubleToLongBits(getMax()) + != java.lang.Double.doubleToLongBits( + other.getMax())) return false; + if (java.lang.Double.doubleToLongBits(getMin()) + != java.lang.Double.doubleToLongBits( + other.getMin())) return false; + if (java.lang.Double.doubleToLongBits(getMean()) + != java.lang.Double.doubleToLongBits( + other.getMean())) return false; + if (java.lang.Double.doubleToLongBits(getSumSquares()) + != java.lang.Double.doubleToLongBits( + other.getSumSquares())) 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) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + COUNT_FIELD_NUMBER; + hash = (53 * hash) + getCount(); + hash = (37 * hash) + MAX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getMax())); + hash = (37 * hash) + MIN_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getMin())); + hash = (37 * hash) + MEAN_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getMean())); + hash = (37 * hash) + SUMSQUARES_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getSumSquares())); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.RealInfoProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.RealInfoProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.RealInfoProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.RealInfoProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.RealInfoProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.RealInfoProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.RealInfoProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.RealInfoProto 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 org.tribuo.protos.core.RealInfoProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.RealInfoProto 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 org.tribuo.protos.core.RealInfoProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.RealInfoProto 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(org.tribuo.protos.core.RealInfoProto 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; + } + /** + *
+   *RealInfo proto
+   * 
+ * + * Protobuf type {@code tribuo.core.RealInfoProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.RealInfoProto) + org.tribuo.protos.core.RealInfoProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_RealInfoProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_RealInfoProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.RealInfoProto.class, org.tribuo.protos.core.RealInfoProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.RealInfoProto.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(); + name_ = ""; + + count_ = 0; + + max_ = 0D; + + min_ = 0D; + + mean_ = 0D; + + sumSquares_ = 0D; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_RealInfoProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.RealInfoProto getDefaultInstanceForType() { + return org.tribuo.protos.core.RealInfoProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.RealInfoProto build() { + org.tribuo.protos.core.RealInfoProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.RealInfoProto buildPartial() { + org.tribuo.protos.core.RealInfoProto result = new org.tribuo.protos.core.RealInfoProto(this); + result.name_ = name_; + result.count_ = count_; + result.max_ = max_; + result.min_ = min_; + result.mean_ = mean_; + result.sumSquares_ = sumSquares_; + 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 org.tribuo.protos.core.RealInfoProto) { + return mergeFrom((org.tribuo.protos.core.RealInfoProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.RealInfoProto other) { + if (other == org.tribuo.protos.core.RealInfoProto.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getCount() != 0) { + setCount(other.getCount()); + } + if (other.getMax() != 0D) { + setMax(other.getMax()); + } + if (other.getMin() != 0D) { + setMin(other.getMin()); + } + if (other.getMean() != 0D) { + setMean(other.getMean()); + } + if (other.getSumSquares() != 0D) { + setSumSquares(other.getSumSquares()); + } + 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 { + org.tribuo.protos.core.RealInfoProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.RealInfoProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * string name = 1; + * @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 = 1; + * @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 = 1; + * @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 = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * string name = 1; + * @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; + } + + private int count_ ; + /** + * int32 count = 2; + * @return The count. + */ + @java.lang.Override + public int getCount() { + return count_; + } + /** + * int32 count = 2; + * @param value The count to set. + * @return This builder for chaining. + */ + public Builder setCount(int value) { + + count_ = value; + onChanged(); + return this; + } + /** + * int32 count = 2; + * @return This builder for chaining. + */ + public Builder clearCount() { + + count_ = 0; + onChanged(); + return this; + } + + private double max_ ; + /** + * double max = 10; + * @return The max. + */ + @java.lang.Override + public double getMax() { + return max_; + } + /** + * double max = 10; + * @param value The max to set. + * @return This builder for chaining. + */ + public Builder setMax(double value) { + + max_ = value; + onChanged(); + return this; + } + /** + * double max = 10; + * @return This builder for chaining. + */ + public Builder clearMax() { + + max_ = 0D; + onChanged(); + return this; + } + + private double min_ ; + /** + * double min = 11; + * @return The min. + */ + @java.lang.Override + public double getMin() { + return min_; + } + /** + * double min = 11; + * @param value The min to set. + * @return This builder for chaining. + */ + public Builder setMin(double value) { + + min_ = value; + onChanged(); + return this; + } + /** + * double min = 11; + * @return This builder for chaining. + */ + public Builder clearMin() { + + min_ = 0D; + onChanged(); + return this; + } + + private double mean_ ; + /** + * double mean = 12; + * @return The mean. + */ + @java.lang.Override + public double getMean() { + return mean_; + } + /** + * double mean = 12; + * @param value The mean to set. + * @return This builder for chaining. + */ + public Builder setMean(double value) { + + mean_ = value; + onChanged(); + return this; + } + /** + * double mean = 12; + * @return This builder for chaining. + */ + public Builder clearMean() { + + mean_ = 0D; + onChanged(); + return this; + } + + private double sumSquares_ ; + /** + * double sumSquares = 13; + * @return The sumSquares. + */ + @java.lang.Override + public double getSumSquares() { + return sumSquares_; + } + /** + * double sumSquares = 13; + * @param value The sumSquares to set. + * @return This builder for chaining. + */ + public Builder setSumSquares(double value) { + + sumSquares_ = value; + onChanged(); + return this; + } + /** + * double sumSquares = 13; + * @return This builder for chaining. + */ + public Builder clearSumSquares() { + + sumSquares_ = 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:tribuo.core.RealInfoProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.RealInfoProto) + private static final org.tribuo.protos.core.RealInfoProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.RealInfoProto(); + } + + public static org.tribuo.protos.core.RealInfoProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RealInfoProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RealInfoProto(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 org.tribuo.protos.core.RealInfoProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/RealInfoProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/RealInfoProtoOrBuilder.java new file mode 100644 index 000000000..670f27f1d --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/RealInfoProtoOrBuilder.java @@ -0,0 +1,51 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface RealInfoProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.RealInfoProto) + com.google.protobuf.MessageOrBuilder { + + /** + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + * int32 count = 2; + * @return The count. + */ + int getCount(); + + /** + * double max = 10; + * @return The max. + */ + double getMax(); + + /** + * double min = 11; + * @return The min. + */ + double getMin(); + + /** + * double mean = 12; + * @return The mean. + */ + double getMean(); + + /** + * double sumSquares = 13; + * @return The sumSquares. + */ + double getSumSquares(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/SimpleTransformProto.java b/Core/src/main/java/org/tribuo/protos/core/SimpleTransformProto.java new file mode 100644 index 000000000..792eccf8e --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/SimpleTransformProto.java @@ -0,0 +1,699 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *SimpleTransform proto
+ * 
+ * + * Protobuf type {@code tribuo.core.SimpleTransformProto} + */ +public final class SimpleTransformProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.SimpleTransformProto) + SimpleTransformProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use SimpleTransformProto.newBuilder() to construct. + private SimpleTransformProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private SimpleTransformProto() { + op_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new SimpleTransformProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private SimpleTransformProto( + 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 10: { + java.lang.String s = input.readStringRequireUtf8(); + + op_ = s; + break; + } + case 17: { + + firstOperand_ = input.readDouble(); + break; + } + case 25: { + + secondOperand_ = input.readDouble(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_SimpleTransformProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_SimpleTransformProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.SimpleTransformProto.class, org.tribuo.protos.core.SimpleTransformProto.Builder.class); + } + + public static final int OP_FIELD_NUMBER = 1; + private volatile java.lang.Object op_; + /** + * string op = 1; + * @return The op. + */ + @java.lang.Override + public java.lang.String getOp() { + java.lang.Object ref = op_; + 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(); + op_ = s; + return s; + } + } + /** + * string op = 1; + * @return The bytes for op. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getOpBytes() { + java.lang.Object ref = op_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + op_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FIRST_OPERAND_FIELD_NUMBER = 2; + private double firstOperand_; + /** + * double first_operand = 2; + * @return The firstOperand. + */ + @java.lang.Override + public double getFirstOperand() { + return firstOperand_; + } + + public static final int SECOND_OPERAND_FIELD_NUMBER = 3; + private double secondOperand_; + /** + * double second_operand = 3; + * @return The secondOperand. + */ + @java.lang.Override + public double getSecondOperand() { + return secondOperand_; + } + + 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(op_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, op_); + } + if (java.lang.Double.doubleToRawLongBits(firstOperand_) != 0) { + output.writeDouble(2, firstOperand_); + } + if (java.lang.Double.doubleToRawLongBits(secondOperand_) != 0) { + output.writeDouble(3, secondOperand_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(op_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, op_); + } + if (java.lang.Double.doubleToRawLongBits(firstOperand_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(2, firstOperand_); + } + if (java.lang.Double.doubleToRawLongBits(secondOperand_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(3, secondOperand_); + } + 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 org.tribuo.protos.core.SimpleTransformProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.SimpleTransformProto other = (org.tribuo.protos.core.SimpleTransformProto) obj; + + if (!getOp() + .equals(other.getOp())) return false; + if (java.lang.Double.doubleToLongBits(getFirstOperand()) + != java.lang.Double.doubleToLongBits( + other.getFirstOperand())) return false; + if (java.lang.Double.doubleToLongBits(getSecondOperand()) + != java.lang.Double.doubleToLongBits( + other.getSecondOperand())) 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) + OP_FIELD_NUMBER; + hash = (53 * hash) + getOp().hashCode(); + hash = (37 * hash) + FIRST_OPERAND_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getFirstOperand())); + hash = (37 * hash) + SECOND_OPERAND_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getSecondOperand())); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.SimpleTransformProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.SimpleTransformProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.SimpleTransformProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.SimpleTransformProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.SimpleTransformProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.SimpleTransformProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.SimpleTransformProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.SimpleTransformProto 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 org.tribuo.protos.core.SimpleTransformProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.SimpleTransformProto 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 org.tribuo.protos.core.SimpleTransformProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.SimpleTransformProto 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(org.tribuo.protos.core.SimpleTransformProto 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; + } + /** + *
+   *SimpleTransform proto
+   * 
+ * + * Protobuf type {@code tribuo.core.SimpleTransformProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.SimpleTransformProto) + org.tribuo.protos.core.SimpleTransformProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_SimpleTransformProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_SimpleTransformProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.SimpleTransformProto.class, org.tribuo.protos.core.SimpleTransformProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.SimpleTransformProto.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(); + op_ = ""; + + firstOperand_ = 0D; + + secondOperand_ = 0D; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_SimpleTransformProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.SimpleTransformProto getDefaultInstanceForType() { + return org.tribuo.protos.core.SimpleTransformProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.SimpleTransformProto build() { + org.tribuo.protos.core.SimpleTransformProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.SimpleTransformProto buildPartial() { + org.tribuo.protos.core.SimpleTransformProto result = new org.tribuo.protos.core.SimpleTransformProto(this); + result.op_ = op_; + result.firstOperand_ = firstOperand_; + result.secondOperand_ = secondOperand_; + 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 org.tribuo.protos.core.SimpleTransformProto) { + return mergeFrom((org.tribuo.protos.core.SimpleTransformProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.SimpleTransformProto other) { + if (other == org.tribuo.protos.core.SimpleTransformProto.getDefaultInstance()) return this; + if (!other.getOp().isEmpty()) { + op_ = other.op_; + onChanged(); + } + if (other.getFirstOperand() != 0D) { + setFirstOperand(other.getFirstOperand()); + } + if (other.getSecondOperand() != 0D) { + setSecondOperand(other.getSecondOperand()); + } + 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 { + org.tribuo.protos.core.SimpleTransformProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.SimpleTransformProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object op_ = ""; + /** + * string op = 1; + * @return The op. + */ + public java.lang.String getOp() { + java.lang.Object ref = op_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + op_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string op = 1; + * @return The bytes for op. + */ + public com.google.protobuf.ByteString + getOpBytes() { + java.lang.Object ref = op_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + op_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string op = 1; + * @param value The op to set. + * @return This builder for chaining. + */ + public Builder setOp( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + op_ = value; + onChanged(); + return this; + } + /** + * string op = 1; + * @return This builder for chaining. + */ + public Builder clearOp() { + + op_ = getDefaultInstance().getOp(); + onChanged(); + return this; + } + /** + * string op = 1; + * @param value The bytes for op to set. + * @return This builder for chaining. + */ + public Builder setOpBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + op_ = value; + onChanged(); + return this; + } + + private double firstOperand_ ; + /** + * double first_operand = 2; + * @return The firstOperand. + */ + @java.lang.Override + public double getFirstOperand() { + return firstOperand_; + } + /** + * double first_operand = 2; + * @param value The firstOperand to set. + * @return This builder for chaining. + */ + public Builder setFirstOperand(double value) { + + firstOperand_ = value; + onChanged(); + return this; + } + /** + * double first_operand = 2; + * @return This builder for chaining. + */ + public Builder clearFirstOperand() { + + firstOperand_ = 0D; + onChanged(); + return this; + } + + private double secondOperand_ ; + /** + * double second_operand = 3; + * @return The secondOperand. + */ + @java.lang.Override + public double getSecondOperand() { + return secondOperand_; + } + /** + * double second_operand = 3; + * @param value The secondOperand to set. + * @return This builder for chaining. + */ + public Builder setSecondOperand(double value) { + + secondOperand_ = value; + onChanged(); + return this; + } + /** + * double second_operand = 3; + * @return This builder for chaining. + */ + public Builder clearSecondOperand() { + + secondOperand_ = 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:tribuo.core.SimpleTransformProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.SimpleTransformProto) + private static final org.tribuo.protos.core.SimpleTransformProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.SimpleTransformProto(); + } + + public static org.tribuo.protos.core.SimpleTransformProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SimpleTransformProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SimpleTransformProto(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 org.tribuo.protos.core.SimpleTransformProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/SimpleTransformProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/SimpleTransformProtoOrBuilder.java new file mode 100644 index 000000000..e909a96ef --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/SimpleTransformProtoOrBuilder.java @@ -0,0 +1,33 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface SimpleTransformProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.SimpleTransformProto) + com.google.protobuf.MessageOrBuilder { + + /** + * string op = 1; + * @return The op. + */ + java.lang.String getOp(); + /** + * string op = 1; + * @return The bytes for op. + */ + com.google.protobuf.ByteString + getOpBytes(); + + /** + * double first_operand = 2; + * @return The firstOperand. + */ + double getFirstOperand(); + + /** + * double second_operand = 3; + * @return The secondOperand. + */ + double getSecondOperand(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/TestCountTransformerProto.java b/Core/src/main/java/org/tribuo/protos/core/TestCountTransformerProto.java new file mode 100644 index 000000000..b48b2cb31 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/TestCountTransformerProto.java @@ -0,0 +1,910 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +/** + *
+ *CountTransformer proto (used in tests)
+ * 
+ * + * Protobuf type {@code tribuo.core.TestCountTransformerProto} + */ +public final class TestCountTransformerProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.TestCountTransformerProto) + TestCountTransformerProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use TestCountTransformerProto.newBuilder() to construct. + private TestCountTransformerProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private TestCountTransformerProto() { + countMapKeys_ = emptyDoubleList(); + countMapValues_ = emptyLongList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new TestCountTransformerProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private TestCountTransformerProto( + 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: { + + count_ = input.readInt32(); + break; + } + case 16: { + + sparseCount_ = input.readInt32(); + break; + } + case 25: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + countMapKeys_ = newDoubleList(); + mutable_bitField0_ |= 0x00000001; + } + countMapKeys_.addDouble(input.readDouble()); + break; + } + case 26: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) { + countMapKeys_ = newDoubleList(); + mutable_bitField0_ |= 0x00000001; + } + while (input.getBytesUntilLimit() > 0) { + countMapKeys_.addDouble(input.readDouble()); + } + input.popLimit(limit); + break; + } + case 32: { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + countMapValues_ = newLongList(); + mutable_bitField0_ |= 0x00000002; + } + countMapValues_.addLong(input.readInt64()); + break; + } + case 34: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) { + countMapValues_ = newLongList(); + mutable_bitField0_ |= 0x00000002; + } + while (input.getBytesUntilLimit() > 0) { + countMapValues_.addLong(input.readInt64()); + } + input.popLimit(limit); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + countMapKeys_.makeImmutable(); // C + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + countMapValues_.makeImmutable(); // C + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_TestCountTransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_TestCountTransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.TestCountTransformerProto.class, org.tribuo.protos.core.TestCountTransformerProto.Builder.class); + } + + public static final int COUNT_FIELD_NUMBER = 1; + private int count_; + /** + * int32 count = 1; + * @return The count. + */ + @java.lang.Override + public int getCount() { + return count_; + } + + public static final int SPARSECOUNT_FIELD_NUMBER = 2; + private int sparseCount_; + /** + * int32 sparseCount = 2; + * @return The sparseCount. + */ + @java.lang.Override + public int getSparseCount() { + return sparseCount_; + } + + public static final int COUNTMAPKEYS_FIELD_NUMBER = 3; + private com.google.protobuf.Internal.DoubleList countMapKeys_; + /** + * repeated double countMapKeys = 3; + * @return A list containing the countMapKeys. + */ + @java.lang.Override + public java.util.List + getCountMapKeysList() { + return countMapKeys_; + } + /** + * repeated double countMapKeys = 3; + * @return The count of countMapKeys. + */ + public int getCountMapKeysCount() { + return countMapKeys_.size(); + } + /** + * repeated double countMapKeys = 3; + * @param index The index of the element to return. + * @return The countMapKeys at the given index. + */ + public double getCountMapKeys(int index) { + return countMapKeys_.getDouble(index); + } + private int countMapKeysMemoizedSerializedSize = -1; + + public static final int COUNTMAPVALUES_FIELD_NUMBER = 4; + private com.google.protobuf.Internal.LongList countMapValues_; + /** + * repeated int64 countMapValues = 4; + * @return A list containing the countMapValues. + */ + @java.lang.Override + public java.util.List + getCountMapValuesList() { + return countMapValues_; + } + /** + * repeated int64 countMapValues = 4; + * @return The count of countMapValues. + */ + public int getCountMapValuesCount() { + return countMapValues_.size(); + } + /** + * repeated int64 countMapValues = 4; + * @param index The index of the element to return. + * @return The countMapValues at the given index. + */ + public long getCountMapValues(int index) { + return countMapValues_.getLong(index); + } + private int countMapValuesMemoizedSerializedSize = -1; + + 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 (count_ != 0) { + output.writeInt32(1, count_); + } + if (sparseCount_ != 0) { + output.writeInt32(2, sparseCount_); + } + if (getCountMapKeysList().size() > 0) { + output.writeUInt32NoTag(26); + output.writeUInt32NoTag(countMapKeysMemoizedSerializedSize); + } + for (int i = 0; i < countMapKeys_.size(); i++) { + output.writeDoubleNoTag(countMapKeys_.getDouble(i)); + } + if (getCountMapValuesList().size() > 0) { + output.writeUInt32NoTag(34); + output.writeUInt32NoTag(countMapValuesMemoizedSerializedSize); + } + for (int i = 0; i < countMapValues_.size(); i++) { + output.writeInt64NoTag(countMapValues_.getLong(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (count_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, count_); + } + if (sparseCount_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, sparseCount_); + } + { + int dataSize = 0; + dataSize = 8 * getCountMapKeysList().size(); + size += dataSize; + if (!getCountMapKeysList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + countMapKeysMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < countMapValues_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeInt64SizeNoTag(countMapValues_.getLong(i)); + } + size += dataSize; + if (!getCountMapValuesList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + countMapValuesMemoizedSerializedSize = dataSize; + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.tribuo.protos.core.TestCountTransformerProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.TestCountTransformerProto other = (org.tribuo.protos.core.TestCountTransformerProto) obj; + + if (getCount() + != other.getCount()) return false; + if (getSparseCount() + != other.getSparseCount()) return false; + if (!getCountMapKeysList() + .equals(other.getCountMapKeysList())) return false; + if (!getCountMapValuesList() + .equals(other.getCountMapValuesList())) 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) + COUNT_FIELD_NUMBER; + hash = (53 * hash) + getCount(); + hash = (37 * hash) + SPARSECOUNT_FIELD_NUMBER; + hash = (53 * hash) + getSparseCount(); + if (getCountMapKeysCount() > 0) { + hash = (37 * hash) + COUNTMAPKEYS_FIELD_NUMBER; + hash = (53 * hash) + getCountMapKeysList().hashCode(); + } + if (getCountMapValuesCount() > 0) { + hash = (37 * hash) + COUNTMAPVALUES_FIELD_NUMBER; + hash = (53 * hash) + getCountMapValuesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.TestCountTransformerProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TestCountTransformerProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TestCountTransformerProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TestCountTransformerProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TestCountTransformerProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TestCountTransformerProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TestCountTransformerProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TestCountTransformerProto 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 org.tribuo.protos.core.TestCountTransformerProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TestCountTransformerProto 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 org.tribuo.protos.core.TestCountTransformerProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TestCountTransformerProto 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(org.tribuo.protos.core.TestCountTransformerProto 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; + } + /** + *
+   *CountTransformer proto (used in tests)
+   * 
+ * + * Protobuf type {@code tribuo.core.TestCountTransformerProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.TestCountTransformerProto) + org.tribuo.protos.core.TestCountTransformerProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_TestCountTransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_TestCountTransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.TestCountTransformerProto.class, org.tribuo.protos.core.TestCountTransformerProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.TestCountTransformerProto.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(); + count_ = 0; + + sparseCount_ = 0; + + countMapKeys_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000001); + countMapValues_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCoreImpl.internal_static_tribuo_core_TestCountTransformerProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.TestCountTransformerProto getDefaultInstanceForType() { + return org.tribuo.protos.core.TestCountTransformerProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.TestCountTransformerProto build() { + org.tribuo.protos.core.TestCountTransformerProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.TestCountTransformerProto buildPartial() { + org.tribuo.protos.core.TestCountTransformerProto result = new org.tribuo.protos.core.TestCountTransformerProto(this); + int from_bitField0_ = bitField0_; + result.count_ = count_; + result.sparseCount_ = sparseCount_; + if (((bitField0_ & 0x00000001) != 0)) { + countMapKeys_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.countMapKeys_ = countMapKeys_; + if (((bitField0_ & 0x00000002) != 0)) { + countMapValues_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.countMapValues_ = countMapValues_; + 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 org.tribuo.protos.core.TestCountTransformerProto) { + return mergeFrom((org.tribuo.protos.core.TestCountTransformerProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.TestCountTransformerProto other) { + if (other == org.tribuo.protos.core.TestCountTransformerProto.getDefaultInstance()) return this; + if (other.getCount() != 0) { + setCount(other.getCount()); + } + if (other.getSparseCount() != 0) { + setSparseCount(other.getSparseCount()); + } + if (!other.countMapKeys_.isEmpty()) { + if (countMapKeys_.isEmpty()) { + countMapKeys_ = other.countMapKeys_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureCountMapKeysIsMutable(); + countMapKeys_.addAll(other.countMapKeys_); + } + onChanged(); + } + if (!other.countMapValues_.isEmpty()) { + if (countMapValues_.isEmpty()) { + countMapValues_ = other.countMapValues_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureCountMapValuesIsMutable(); + countMapValues_.addAll(other.countMapValues_); + } + 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 { + org.tribuo.protos.core.TestCountTransformerProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.TestCountTransformerProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private int count_ ; + /** + * int32 count = 1; + * @return The count. + */ + @java.lang.Override + public int getCount() { + return count_; + } + /** + * int32 count = 1; + * @param value The count to set. + * @return This builder for chaining. + */ + public Builder setCount(int value) { + + count_ = value; + onChanged(); + return this; + } + /** + * int32 count = 1; + * @return This builder for chaining. + */ + public Builder clearCount() { + + count_ = 0; + onChanged(); + return this; + } + + private int sparseCount_ ; + /** + * int32 sparseCount = 2; + * @return The sparseCount. + */ + @java.lang.Override + public int getSparseCount() { + return sparseCount_; + } + /** + * int32 sparseCount = 2; + * @param value The sparseCount to set. + * @return This builder for chaining. + */ + public Builder setSparseCount(int value) { + + sparseCount_ = value; + onChanged(); + return this; + } + /** + * int32 sparseCount = 2; + * @return This builder for chaining. + */ + public Builder clearSparseCount() { + + sparseCount_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Internal.DoubleList countMapKeys_ = emptyDoubleList(); + private void ensureCountMapKeysIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + countMapKeys_ = mutableCopy(countMapKeys_); + bitField0_ |= 0x00000001; + } + } + /** + * repeated double countMapKeys = 3; + * @return A list containing the countMapKeys. + */ + public java.util.List + getCountMapKeysList() { + return ((bitField0_ & 0x00000001) != 0) ? + java.util.Collections.unmodifiableList(countMapKeys_) : countMapKeys_; + } + /** + * repeated double countMapKeys = 3; + * @return The count of countMapKeys. + */ + public int getCountMapKeysCount() { + return countMapKeys_.size(); + } + /** + * repeated double countMapKeys = 3; + * @param index The index of the element to return. + * @return The countMapKeys at the given index. + */ + public double getCountMapKeys(int index) { + return countMapKeys_.getDouble(index); + } + /** + * repeated double countMapKeys = 3; + * @param index The index to set the value at. + * @param value The countMapKeys to set. + * @return This builder for chaining. + */ + public Builder setCountMapKeys( + int index, double value) { + ensureCountMapKeysIsMutable(); + countMapKeys_.setDouble(index, value); + onChanged(); + return this; + } + /** + * repeated double countMapKeys = 3; + * @param value The countMapKeys to add. + * @return This builder for chaining. + */ + public Builder addCountMapKeys(double value) { + ensureCountMapKeysIsMutable(); + countMapKeys_.addDouble(value); + onChanged(); + return this; + } + /** + * repeated double countMapKeys = 3; + * @param values The countMapKeys to add. + * @return This builder for chaining. + */ + public Builder addAllCountMapKeys( + java.lang.Iterable values) { + ensureCountMapKeysIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, countMapKeys_); + onChanged(); + return this; + } + /** + * repeated double countMapKeys = 3; + * @return This builder for chaining. + */ + public Builder clearCountMapKeys() { + countMapKeys_ = emptyDoubleList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + private com.google.protobuf.Internal.LongList countMapValues_ = emptyLongList(); + private void ensureCountMapValuesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + countMapValues_ = mutableCopy(countMapValues_); + bitField0_ |= 0x00000002; + } + } + /** + * repeated int64 countMapValues = 4; + * @return A list containing the countMapValues. + */ + public java.util.List + getCountMapValuesList() { + return ((bitField0_ & 0x00000002) != 0) ? + java.util.Collections.unmodifiableList(countMapValues_) : countMapValues_; + } + /** + * repeated int64 countMapValues = 4; + * @return The count of countMapValues. + */ + public int getCountMapValuesCount() { + return countMapValues_.size(); + } + /** + * repeated int64 countMapValues = 4; + * @param index The index of the element to return. + * @return The countMapValues at the given index. + */ + public long getCountMapValues(int index) { + return countMapValues_.getLong(index); + } + /** + * repeated int64 countMapValues = 4; + * @param index The index to set the value at. + * @param value The countMapValues to set. + * @return This builder for chaining. + */ + public Builder setCountMapValues( + int index, long value) { + ensureCountMapValuesIsMutable(); + countMapValues_.setLong(index, value); + onChanged(); + return this; + } + /** + * repeated int64 countMapValues = 4; + * @param value The countMapValues to add. + * @return This builder for chaining. + */ + public Builder addCountMapValues(long value) { + ensureCountMapValuesIsMutable(); + countMapValues_.addLong(value); + onChanged(); + return this; + } + /** + * repeated int64 countMapValues = 4; + * @param values The countMapValues to add. + * @return This builder for chaining. + */ + public Builder addAllCountMapValues( + java.lang.Iterable values) { + ensureCountMapValuesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, countMapValues_); + onChanged(); + return this; + } + /** + * repeated int64 countMapValues = 4; + * @return This builder for chaining. + */ + public Builder clearCountMapValues() { + countMapValues_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000002); + 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:tribuo.core.TestCountTransformerProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.TestCountTransformerProto) + private static final org.tribuo.protos.core.TestCountTransformerProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.TestCountTransformerProto(); + } + + public static org.tribuo.protos.core.TestCountTransformerProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TestCountTransformerProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TestCountTransformerProto(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 org.tribuo.protos.core.TestCountTransformerProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/TestCountTransformerProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/TestCountTransformerProtoOrBuilder.java new file mode 100644 index 000000000..8681059c6 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/TestCountTransformerProtoOrBuilder.java @@ -0,0 +1,55 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public interface TestCountTransformerProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.TestCountTransformerProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 count = 1; + * @return The count. + */ + int getCount(); + + /** + * int32 sparseCount = 2; + * @return The sparseCount. + */ + int getSparseCount(); + + /** + * repeated double countMapKeys = 3; + * @return A list containing the countMapKeys. + */ + java.util.List getCountMapKeysList(); + /** + * repeated double countMapKeys = 3; + * @return The count of countMapKeys. + */ + int getCountMapKeysCount(); + /** + * repeated double countMapKeys = 3; + * @param index The index of the element to return. + * @return The countMapKeys at the given index. + */ + double getCountMapKeys(int index); + + /** + * repeated int64 countMapValues = 4; + * @return A list containing the countMapValues. + */ + java.util.List getCountMapValuesList(); + /** + * repeated int64 countMapValues = 4; + * @return The count of countMapValues. + */ + int getCountMapValuesCount(); + /** + * repeated int64 countMapValues = 4; + * @param index The index of the element to return. + * @return The countMapValues at the given index. + */ + long getCountMapValues(int index); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/TransformerListProto.java b/Core/src/main/java/org/tribuo/protos/core/TransformerListProto.java new file mode 100644 index 000000000..7d933e9e3 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/TransformerListProto.java @@ -0,0 +1,780 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Transformer list proto
+ * 
+ * + * Protobuf type {@code tribuo.core.TransformerListProto} + */ +public final class TransformerListProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.TransformerListProto) + TransformerListProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use TransformerListProto.newBuilder() to construct. + private TransformerListProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private TransformerListProto() { + transformer_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new TransformerListProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private TransformerListProto( + 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)) { + transformer_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + transformer_.add( + input.readMessage(org.tribuo.protos.core.TransformerProto.parser(), extensionRegistry)); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + transformer_ = java.util.Collections.unmodifiableList(transformer_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerListProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerListProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.TransformerListProto.class, org.tribuo.protos.core.TransformerListProto.Builder.class); + } + + public static final int TRANSFORMER_FIELD_NUMBER = 1; + private java.util.List transformer_; + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + @java.lang.Override + public java.util.List getTransformerList() { + return transformer_; + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + @java.lang.Override + public java.util.List + getTransformerOrBuilderList() { + return transformer_; + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + @java.lang.Override + public int getTransformerCount() { + return transformer_.size(); + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + @java.lang.Override + public org.tribuo.protos.core.TransformerProto getTransformer(int index) { + return transformer_.get(index); + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + @java.lang.Override + public org.tribuo.protos.core.TransformerProtoOrBuilder getTransformerOrBuilder( + int index) { + return transformer_.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 < transformer_.size(); i++) { + output.writeMessage(1, transformer_.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 < transformer_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, transformer_.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 org.tribuo.protos.core.TransformerListProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.TransformerListProto other = (org.tribuo.protos.core.TransformerListProto) obj; + + if (!getTransformerList() + .equals(other.getTransformerList())) 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 (getTransformerCount() > 0) { + hash = (37 * hash) + TRANSFORMER_FIELD_NUMBER; + hash = (53 * hash) + getTransformerList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.TransformerListProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TransformerListProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TransformerListProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TransformerListProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TransformerListProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TransformerListProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TransformerListProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TransformerListProto 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 org.tribuo.protos.core.TransformerListProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TransformerListProto 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 org.tribuo.protos.core.TransformerListProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TransformerListProto 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(org.tribuo.protos.core.TransformerListProto 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; + } + /** + *
+   *Transformer list proto
+   * 
+ * + * Protobuf type {@code tribuo.core.TransformerListProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.TransformerListProto) + org.tribuo.protos.core.TransformerListProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerListProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerListProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.TransformerListProto.class, org.tribuo.protos.core.TransformerListProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.TransformerListProto.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getTransformerFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (transformerBuilder_ == null) { + transformer_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + transformerBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerListProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.TransformerListProto getDefaultInstanceForType() { + return org.tribuo.protos.core.TransformerListProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.TransformerListProto build() { + org.tribuo.protos.core.TransformerListProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.TransformerListProto buildPartial() { + org.tribuo.protos.core.TransformerListProto result = new org.tribuo.protos.core.TransformerListProto(this); + int from_bitField0_ = bitField0_; + if (transformerBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + transformer_ = java.util.Collections.unmodifiableList(transformer_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.transformer_ = transformer_; + } else { + result.transformer_ = transformerBuilder_.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 org.tribuo.protos.core.TransformerListProto) { + return mergeFrom((org.tribuo.protos.core.TransformerListProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.TransformerListProto other) { + if (other == org.tribuo.protos.core.TransformerListProto.getDefaultInstance()) return this; + if (transformerBuilder_ == null) { + if (!other.transformer_.isEmpty()) { + if (transformer_.isEmpty()) { + transformer_ = other.transformer_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTransformerIsMutable(); + transformer_.addAll(other.transformer_); + } + onChanged(); + } + } else { + if (!other.transformer_.isEmpty()) { + if (transformerBuilder_.isEmpty()) { + transformerBuilder_.dispose(); + transformerBuilder_ = null; + transformer_ = other.transformer_; + bitField0_ = (bitField0_ & ~0x00000001); + transformerBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getTransformerFieldBuilder() : null; + } else { + transformerBuilder_.addAllMessages(other.transformer_); + } + } + } + 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 { + org.tribuo.protos.core.TransformerListProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.TransformerListProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List transformer_ = + java.util.Collections.emptyList(); + private void ensureTransformerIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + transformer_ = new java.util.ArrayList(transformer_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.TransformerProto, org.tribuo.protos.core.TransformerProto.Builder, org.tribuo.protos.core.TransformerProtoOrBuilder> transformerBuilder_; + + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public java.util.List getTransformerList() { + if (transformerBuilder_ == null) { + return java.util.Collections.unmodifiableList(transformer_); + } else { + return transformerBuilder_.getMessageList(); + } + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public int getTransformerCount() { + if (transformerBuilder_ == null) { + return transformer_.size(); + } else { + return transformerBuilder_.getCount(); + } + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public org.tribuo.protos.core.TransformerProto getTransformer(int index) { + if (transformerBuilder_ == null) { + return transformer_.get(index); + } else { + return transformerBuilder_.getMessage(index); + } + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public Builder setTransformer( + int index, org.tribuo.protos.core.TransformerProto value) { + if (transformerBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTransformerIsMutable(); + transformer_.set(index, value); + onChanged(); + } else { + transformerBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public Builder setTransformer( + int index, org.tribuo.protos.core.TransformerProto.Builder builderForValue) { + if (transformerBuilder_ == null) { + ensureTransformerIsMutable(); + transformer_.set(index, builderForValue.build()); + onChanged(); + } else { + transformerBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public Builder addTransformer(org.tribuo.protos.core.TransformerProto value) { + if (transformerBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTransformerIsMutable(); + transformer_.add(value); + onChanged(); + } else { + transformerBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public Builder addTransformer( + int index, org.tribuo.protos.core.TransformerProto value) { + if (transformerBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTransformerIsMutable(); + transformer_.add(index, value); + onChanged(); + } else { + transformerBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public Builder addTransformer( + org.tribuo.protos.core.TransformerProto.Builder builderForValue) { + if (transformerBuilder_ == null) { + ensureTransformerIsMutable(); + transformer_.add(builderForValue.build()); + onChanged(); + } else { + transformerBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public Builder addTransformer( + int index, org.tribuo.protos.core.TransformerProto.Builder builderForValue) { + if (transformerBuilder_ == null) { + ensureTransformerIsMutable(); + transformer_.add(index, builderForValue.build()); + onChanged(); + } else { + transformerBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public Builder addAllTransformer( + java.lang.Iterable values) { + if (transformerBuilder_ == null) { + ensureTransformerIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, transformer_); + onChanged(); + } else { + transformerBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public Builder clearTransformer() { + if (transformerBuilder_ == null) { + transformer_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + transformerBuilder_.clear(); + } + return this; + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public Builder removeTransformer(int index) { + if (transformerBuilder_ == null) { + ensureTransformerIsMutable(); + transformer_.remove(index); + onChanged(); + } else { + transformerBuilder_.remove(index); + } + return this; + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public org.tribuo.protos.core.TransformerProto.Builder getTransformerBuilder( + int index) { + return getTransformerFieldBuilder().getBuilder(index); + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public org.tribuo.protos.core.TransformerProtoOrBuilder getTransformerOrBuilder( + int index) { + if (transformerBuilder_ == null) { + return transformer_.get(index); } else { + return transformerBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public java.util.List + getTransformerOrBuilderList() { + if (transformerBuilder_ != null) { + return transformerBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(transformer_); + } + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public org.tribuo.protos.core.TransformerProto.Builder addTransformerBuilder() { + return getTransformerFieldBuilder().addBuilder( + org.tribuo.protos.core.TransformerProto.getDefaultInstance()); + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public org.tribuo.protos.core.TransformerProto.Builder addTransformerBuilder( + int index) { + return getTransformerFieldBuilder().addBuilder( + index, org.tribuo.protos.core.TransformerProto.getDefaultInstance()); + } + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + public java.util.List + getTransformerBuilderList() { + return getTransformerFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.TransformerProto, org.tribuo.protos.core.TransformerProto.Builder, org.tribuo.protos.core.TransformerProtoOrBuilder> + getTransformerFieldBuilder() { + if (transformerBuilder_ == null) { + transformerBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + org.tribuo.protos.core.TransformerProto, org.tribuo.protos.core.TransformerProto.Builder, org.tribuo.protos.core.TransformerProtoOrBuilder>( + transformer_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + transformer_ = null; + } + return transformerBuilder_; + } + @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:tribuo.core.TransformerListProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.TransformerListProto) + private static final org.tribuo.protos.core.TransformerListProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.TransformerListProto(); + } + + public static org.tribuo.protos.core.TransformerListProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TransformerListProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TransformerListProto(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 org.tribuo.protos.core.TransformerListProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/TransformerListProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/TransformerListProtoOrBuilder.java new file mode 100644 index 000000000..31e4c59b1 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/TransformerListProtoOrBuilder.java @@ -0,0 +1,33 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface TransformerListProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.TransformerListProto) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + java.util.List + getTransformerList(); + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + org.tribuo.protos.core.TransformerProto getTransformer(int index); + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + int getTransformerCount(); + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + java.util.List + getTransformerOrBuilderList(); + /** + * repeated .tribuo.core.TransformerProto transformer = 1; + */ + org.tribuo.protos.core.TransformerProtoOrBuilder getTransformerOrBuilder( + int index); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/TransformerMapProto.java b/Core/src/main/java/org/tribuo/protos/core/TransformerMapProto.java new file mode 100644 index 000000000..8a65c6701 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/TransformerMapProto.java @@ -0,0 +1,1158 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Transformer map proto
+ * 
+ * + * Protobuf type {@code tribuo.core.TransformerMapProto} + */ +public final class TransformerMapProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.TransformerMapProto) + TransformerMapProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use TransformerMapProto.newBuilder() to construct. + private TransformerMapProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private TransformerMapProto() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new TransformerMapProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private TransformerMapProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + transformers_ = com.google.protobuf.MapField.newMapField( + TransformersDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry + transformers__ = input.readMessage( + TransformersDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + transformers_.getMutableMap().put( + transformers__.getKey(), transformers__.getValue()); + break; + } + case 26: { + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder subBuilder = null; + if (datasetProvenance_ != null) { + subBuilder = datasetProvenance_.toBuilder(); + } + datasetProvenance_ = input.readMessage(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(datasetProvenance_); + datasetProvenance_ = subBuilder.buildPartial(); + } + + break; + } + case 34: { + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder subBuilder = null; + if (transformationMapProvenance_ != null) { + subBuilder = transformationMapProvenance_.toBuilder(); + } + transformationMapProvenance_ = input.readMessage(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(transformationMapProvenance_); + transformationMapProvenance_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerMapProto_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 2: + return internalGetTransformers(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerMapProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.TransformerMapProto.class, org.tribuo.protos.core.TransformerMapProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int TRANSFORMERS_FIELD_NUMBER = 2; + private static final class TransformersDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, org.tribuo.protos.core.TransformerListProto> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerMapProto_TransformersEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + org.tribuo.protos.core.TransformerListProto.getDefaultInstance()); + } + private com.google.protobuf.MapField< + java.lang.String, org.tribuo.protos.core.TransformerListProto> transformers_; + private com.google.protobuf.MapField + internalGetTransformers() { + if (transformers_ == null) { + return com.google.protobuf.MapField.emptyMapField( + TransformersDefaultEntryHolder.defaultEntry); + } + return transformers_; + } + + public int getTransformersCount() { + return internalGetTransformers().getMap().size(); + } + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + + @java.lang.Override + public boolean containsTransformers( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetTransformers().getMap().containsKey(key); + } + /** + * Use {@link #getTransformersMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getTransformers() { + return getTransformersMap(); + } + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + @java.lang.Override + + public java.util.Map getTransformersMap() { + return internalGetTransformers().getMap(); + } + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + @java.lang.Override + + public org.tribuo.protos.core.TransformerListProto getTransformersOrDefault( + java.lang.String key, + org.tribuo.protos.core.TransformerListProto defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetTransformers().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + @java.lang.Override + + public org.tribuo.protos.core.TransformerListProto getTransformersOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetTransformers().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int DATASETPROVENANCE_FIELD_NUMBER = 3; + private com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto datasetProvenance_; + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + * @return Whether the datasetProvenance field is set. + */ + @java.lang.Override + public boolean hasDatasetProvenance() { + return datasetProvenance_ != null; + } + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + * @return The datasetProvenance. + */ + @java.lang.Override + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getDatasetProvenance() { + return datasetProvenance_ == null ? com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : datasetProvenance_; + } + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + */ + @java.lang.Override + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getDatasetProvenanceOrBuilder() { + return getDatasetProvenance(); + } + + public static final int TRANSFORMATIONMAPPROVENANCE_FIELD_NUMBER = 4; + private com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto transformationMapProvenance_; + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + * @return Whether the transformationMapProvenance field is set. + */ + @java.lang.Override + public boolean hasTransformationMapProvenance() { + return transformationMapProvenance_ != null; + } + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + * @return The transformationMapProvenance. + */ + @java.lang.Override + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getTransformationMapProvenance() { + return transformationMapProvenance_ == null ? com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : transformationMapProvenance_; + } + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + */ + @java.lang.Override + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getTransformationMapProvenanceOrBuilder() { + return getTransformationMapProvenance(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + com.google.protobuf.GeneratedMessageV3 + .serializeStringMapTo( + output, + internalGetTransformers(), + TransformersDefaultEntryHolder.defaultEntry, + 2); + if (datasetProvenance_ != null) { + output.writeMessage(3, getDatasetProvenance()); + } + if (transformationMapProvenance_ != null) { + output.writeMessage(4, getTransformationMapProvenance()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + for (java.util.Map.Entry entry + : internalGetTransformers().getMap().entrySet()) { + com.google.protobuf.MapEntry + transformers__ = TransformersDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, transformers__); + } + if (datasetProvenance_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getDatasetProvenance()); + } + if (transformationMapProvenance_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getTransformationMapProvenance()); + } + 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 org.tribuo.protos.core.TransformerMapProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.TransformerMapProto other = (org.tribuo.protos.core.TransformerMapProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!internalGetTransformers().equals( + other.internalGetTransformers())) return false; + if (hasDatasetProvenance() != other.hasDatasetProvenance()) return false; + if (hasDatasetProvenance()) { + if (!getDatasetProvenance() + .equals(other.getDatasetProvenance())) return false; + } + if (hasTransformationMapProvenance() != other.hasTransformationMapProvenance()) return false; + if (hasTransformationMapProvenance()) { + if (!getTransformationMapProvenance() + .equals(other.getTransformationMapProvenance())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + if (!internalGetTransformers().getMap().isEmpty()) { + hash = (37 * hash) + TRANSFORMERS_FIELD_NUMBER; + hash = (53 * hash) + internalGetTransformers().hashCode(); + } + if (hasDatasetProvenance()) { + hash = (37 * hash) + DATASETPROVENANCE_FIELD_NUMBER; + hash = (53 * hash) + getDatasetProvenance().hashCode(); + } + if (hasTransformationMapProvenance()) { + hash = (37 * hash) + TRANSFORMATIONMAPPROVENANCE_FIELD_NUMBER; + hash = (53 * hash) + getTransformationMapProvenance().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.TransformerMapProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TransformerMapProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TransformerMapProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TransformerMapProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TransformerMapProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TransformerMapProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TransformerMapProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TransformerMapProto 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 org.tribuo.protos.core.TransformerMapProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TransformerMapProto 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 org.tribuo.protos.core.TransformerMapProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TransformerMapProto 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(org.tribuo.protos.core.TransformerMapProto 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; + } + /** + *
+   *Transformer map proto
+   * 
+ * + * Protobuf type {@code tribuo.core.TransformerMapProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.TransformerMapProto) + org.tribuo.protos.core.TransformerMapProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerMapProto_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 2: + return internalGetTransformers(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField( + int number) { + switch (number) { + case 2: + return internalGetMutableTransformers(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerMapProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.TransformerMapProto.class, org.tribuo.protos.core.TransformerMapProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.TransformerMapProto.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(); + version_ = 0; + + internalGetMutableTransformers().clear(); + if (datasetProvenanceBuilder_ == null) { + datasetProvenance_ = null; + } else { + datasetProvenance_ = null; + datasetProvenanceBuilder_ = null; + } + if (transformationMapProvenanceBuilder_ == null) { + transformationMapProvenance_ = null; + } else { + transformationMapProvenance_ = null; + transformationMapProvenanceBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerMapProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.TransformerMapProto getDefaultInstanceForType() { + return org.tribuo.protos.core.TransformerMapProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.TransformerMapProto build() { + org.tribuo.protos.core.TransformerMapProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.TransformerMapProto buildPartial() { + org.tribuo.protos.core.TransformerMapProto result = new org.tribuo.protos.core.TransformerMapProto(this); + int from_bitField0_ = bitField0_; + result.version_ = version_; + result.transformers_ = internalGetTransformers(); + result.transformers_.makeImmutable(); + if (datasetProvenanceBuilder_ == null) { + result.datasetProvenance_ = datasetProvenance_; + } else { + result.datasetProvenance_ = datasetProvenanceBuilder_.build(); + } + if (transformationMapProvenanceBuilder_ == null) { + result.transformationMapProvenance_ = transformationMapProvenance_; + } else { + result.transformationMapProvenance_ = transformationMapProvenanceBuilder_.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 org.tribuo.protos.core.TransformerMapProto) { + return mergeFrom((org.tribuo.protos.core.TransformerMapProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.TransformerMapProto other) { + if (other == org.tribuo.protos.core.TransformerMapProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + internalGetMutableTransformers().mergeFrom( + other.internalGetTransformers()); + if (other.hasDatasetProvenance()) { + mergeDatasetProvenance(other.getDatasetProvenance()); + } + if (other.hasTransformationMapProvenance()) { + mergeTransformationMapProvenance(other.getTransformationMapProvenance()); + } + 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 { + org.tribuo.protos.core.TransformerMapProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.TransformerMapProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, org.tribuo.protos.core.TransformerListProto> transformers_; + private com.google.protobuf.MapField + internalGetTransformers() { + if (transformers_ == null) { + return com.google.protobuf.MapField.emptyMapField( + TransformersDefaultEntryHolder.defaultEntry); + } + return transformers_; + } + private com.google.protobuf.MapField + internalGetMutableTransformers() { + onChanged();; + if (transformers_ == null) { + transformers_ = com.google.protobuf.MapField.newMapField( + TransformersDefaultEntryHolder.defaultEntry); + } + if (!transformers_.isMutable()) { + transformers_ = transformers_.copy(); + } + return transformers_; + } + + public int getTransformersCount() { + return internalGetTransformers().getMap().size(); + } + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + + @java.lang.Override + public boolean containsTransformers( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetTransformers().getMap().containsKey(key); + } + /** + * Use {@link #getTransformersMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getTransformers() { + return getTransformersMap(); + } + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + @java.lang.Override + + public java.util.Map getTransformersMap() { + return internalGetTransformers().getMap(); + } + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + @java.lang.Override + + public org.tribuo.protos.core.TransformerListProto getTransformersOrDefault( + java.lang.String key, + org.tribuo.protos.core.TransformerListProto defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetTransformers().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + @java.lang.Override + + public org.tribuo.protos.core.TransformerListProto getTransformersOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetTransformers().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearTransformers() { + internalGetMutableTransformers().getMutableMap() + .clear(); + return this; + } + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + + public Builder removeTransformers( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableTransformers().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableTransformers() { + return internalGetMutableTransformers().getMutableMap(); + } + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + public Builder putTransformers( + java.lang.String key, + org.tribuo.protos.core.TransformerListProto value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { + throw new NullPointerException("map value"); +} + + internalGetMutableTransformers().getMutableMap() + .put(key, value); + return this; + } + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + + public Builder putAllTransformers( + java.util.Map values) { + internalGetMutableTransformers().getMutableMap() + .putAll(values); + return this; + } + + private com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto datasetProvenance_; + private com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder> datasetProvenanceBuilder_; + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + * @return Whether the datasetProvenance field is set. + */ + public boolean hasDatasetProvenance() { + return datasetProvenanceBuilder_ != null || datasetProvenance_ != null; + } + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + * @return The datasetProvenance. + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getDatasetProvenance() { + if (datasetProvenanceBuilder_ == null) { + return datasetProvenance_ == null ? com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : datasetProvenance_; + } else { + return datasetProvenanceBuilder_.getMessage(); + } + } + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + */ + public Builder setDatasetProvenance(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto value) { + if (datasetProvenanceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + datasetProvenance_ = value; + onChanged(); + } else { + datasetProvenanceBuilder_.setMessage(value); + } + + return this; + } + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + */ + public Builder setDatasetProvenance( + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder builderForValue) { + if (datasetProvenanceBuilder_ == null) { + datasetProvenance_ = builderForValue.build(); + onChanged(); + } else { + datasetProvenanceBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + */ + public Builder mergeDatasetProvenance(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto value) { + if (datasetProvenanceBuilder_ == null) { + if (datasetProvenance_ != null) { + datasetProvenance_ = + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.newBuilder(datasetProvenance_).mergeFrom(value).buildPartial(); + } else { + datasetProvenance_ = value; + } + onChanged(); + } else { + datasetProvenanceBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + */ + public Builder clearDatasetProvenance() { + if (datasetProvenanceBuilder_ == null) { + datasetProvenance_ = null; + onChanged(); + } else { + datasetProvenance_ = null; + datasetProvenanceBuilder_ = null; + } + + return this; + } + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder getDatasetProvenanceBuilder() { + + onChanged(); + return getDatasetProvenanceFieldBuilder().getBuilder(); + } + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getDatasetProvenanceOrBuilder() { + if (datasetProvenanceBuilder_ != null) { + return datasetProvenanceBuilder_.getMessageOrBuilder(); + } else { + return datasetProvenance_ == null ? + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : datasetProvenance_; + } + } + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder> + getDatasetProvenanceFieldBuilder() { + if (datasetProvenanceBuilder_ == null) { + datasetProvenanceBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder>( + getDatasetProvenance(), + getParentForChildren(), + isClean()); + datasetProvenance_ = null; + } + return datasetProvenanceBuilder_; + } + + private com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto transformationMapProvenance_; + private com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder> transformationMapProvenanceBuilder_; + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + * @return Whether the transformationMapProvenance field is set. + */ + public boolean hasTransformationMapProvenance() { + return transformationMapProvenanceBuilder_ != null || transformationMapProvenance_ != null; + } + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + * @return The transformationMapProvenance. + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getTransformationMapProvenance() { + if (transformationMapProvenanceBuilder_ == null) { + return transformationMapProvenance_ == null ? com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : transformationMapProvenance_; + } else { + return transformationMapProvenanceBuilder_.getMessage(); + } + } + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + */ + public Builder setTransformationMapProvenance(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto value) { + if (transformationMapProvenanceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + transformationMapProvenance_ = value; + onChanged(); + } else { + transformationMapProvenanceBuilder_.setMessage(value); + } + + return this; + } + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + */ + public Builder setTransformationMapProvenance( + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder builderForValue) { + if (transformationMapProvenanceBuilder_ == null) { + transformationMapProvenance_ = builderForValue.build(); + onChanged(); + } else { + transformationMapProvenanceBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + */ + public Builder mergeTransformationMapProvenance(com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto value) { + if (transformationMapProvenanceBuilder_ == null) { + if (transformationMapProvenance_ != null) { + transformationMapProvenance_ = + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.newBuilder(transformationMapProvenance_).mergeFrom(value).buildPartial(); + } else { + transformationMapProvenance_ = value; + } + onChanged(); + } else { + transformationMapProvenanceBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + */ + public Builder clearTransformationMapProvenance() { + if (transformationMapProvenanceBuilder_ == null) { + transformationMapProvenance_ = null; + onChanged(); + } else { + transformationMapProvenance_ = null; + transformationMapProvenanceBuilder_ = null; + } + + return this; + } + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder getTransformationMapProvenanceBuilder() { + + onChanged(); + return getTransformationMapProvenanceFieldBuilder().getBuilder(); + } + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + */ + public com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getTransformationMapProvenanceOrBuilder() { + if (transformationMapProvenanceBuilder_ != null) { + return transformationMapProvenanceBuilder_.getMessageOrBuilder(); + } else { + return transformationMapProvenance_ == null ? + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.getDefaultInstance() : transformationMapProvenance_; + } + } + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder> + getTransformationMapProvenanceFieldBuilder() { + if (transformationMapProvenanceBuilder_ == null) { + transformationMapProvenanceBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto.Builder, com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder>( + getTransformationMapProvenance(), + getParentForChildren(), + isClean()); + transformationMapProvenance_ = null; + } + return transformationMapProvenanceBuilder_; + } + @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:tribuo.core.TransformerMapProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.TransformerMapProto) + private static final org.tribuo.protos.core.TransformerMapProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.TransformerMapProto(); + } + + public static org.tribuo.protos.core.TransformerMapProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TransformerMapProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TransformerMapProto(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 org.tribuo.protos.core.TransformerMapProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/TransformerMapProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/TransformerMapProtoOrBuilder.java new file mode 100644 index 000000000..2755e601a --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/TransformerMapProtoOrBuilder.java @@ -0,0 +1,81 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface TransformerMapProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.TransformerMapProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + int getTransformersCount(); + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + boolean containsTransformers( + java.lang.String key); + /** + * Use {@link #getTransformersMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getTransformers(); + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + java.util.Map + getTransformersMap(); + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + + /* nullable */ +org.tribuo.protos.core.TransformerListProto getTransformersOrDefault( + java.lang.String key, + /* nullable */ +org.tribuo.protos.core.TransformerListProto defaultValue); + /** + * map<string, .tribuo.core.TransformerListProto> transformers = 2; + */ + + org.tribuo.protos.core.TransformerListProto getTransformersOrThrow( + java.lang.String key); + + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + * @return Whether the datasetProvenance field is set. + */ + boolean hasDatasetProvenance(); + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + * @return The datasetProvenance. + */ + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getDatasetProvenance(); + /** + * .olcut.RootProvenanceProto datasetProvenance = 3; + */ + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getDatasetProvenanceOrBuilder(); + + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + * @return Whether the transformationMapProvenance field is set. + */ + boolean hasTransformationMapProvenance(); + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + * @return The transformationMapProvenance. + */ + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProto getTransformationMapProvenance(); + /** + * .olcut.RootProvenanceProto transformationMapProvenance = 4; + */ + com.oracle.labs.mlrg.olcut.config.protobuf.protos.RootProvenanceProtoOrBuilder getTransformationMapProvenanceOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/TransformerProto.java b/Core/src/main/java/org/tribuo/protos/core/TransformerProto.java new file mode 100644 index 000000000..260ee1088 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/TransformerProto.java @@ -0,0 +1,819 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Transformer redirection proto
+ * 
+ * + * Protobuf type {@code tribuo.core.TransformerProto} + */ +public final class TransformerProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.TransformerProto) + TransformerProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use TransformerProto.newBuilder() to construct. + private TransformerProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private TransformerProto() { + className_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new TransformerProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private TransformerProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + com.google.protobuf.Any.Builder subBuilder = null; + if (serializedData_ != null) { + subBuilder = serializedData_.toBuilder(); + } + serializedData_ = input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(serializedData_); + serializedData_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.TransformerProto.class, org.tribuo.protos.core.TransformerProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERIALIZED_DATA_FIELD_NUMBER = 3; + private com.google.protobuf.Any serializedData_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + @java.lang.Override + public boolean hasSerializedData() { + return serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + @java.lang.Override + public com.google.protobuf.Any getSerializedData() { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + @java.lang.Override + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + return getSerializedData(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (serializedData_ != null) { + output.writeMessage(3, getSerializedData()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (serializedData_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getSerializedData()); + } + 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 org.tribuo.protos.core.TransformerProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.TransformerProto other = (org.tribuo.protos.core.TransformerProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasSerializedData() != other.hasSerializedData()) return false; + if (hasSerializedData()) { + if (!getSerializedData() + .equals(other.getSerializedData())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasSerializedData()) { + hash = (37 * hash) + SERIALIZED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getSerializedData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.TransformerProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TransformerProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TransformerProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TransformerProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TransformerProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.TransformerProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.TransformerProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TransformerProto 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 org.tribuo.protos.core.TransformerProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TransformerProto 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 org.tribuo.protos.core.TransformerProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.TransformerProto 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(org.tribuo.protos.core.TransformerProto 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; + } + /** + *
+   *Transformer redirection proto
+   * 
+ * + * Protobuf type {@code tribuo.core.TransformerProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.TransformerProto) + org.tribuo.protos.core.TransformerProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.TransformerProto.class, org.tribuo.protos.core.TransformerProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.TransformerProto.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(); + version_ = 0; + + className_ = ""; + + if (serializedDataBuilder_ == null) { + serializedData_ = null; + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_TransformerProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.TransformerProto getDefaultInstanceForType() { + return org.tribuo.protos.core.TransformerProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.TransformerProto build() { + org.tribuo.protos.core.TransformerProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.TransformerProto buildPartial() { + org.tribuo.protos.core.TransformerProto result = new org.tribuo.protos.core.TransformerProto(this); + result.version_ = version_; + result.className_ = className_; + if (serializedDataBuilder_ == null) { + result.serializedData_ = serializedData_; + } else { + result.serializedData_ = serializedDataBuilder_.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 org.tribuo.protos.core.TransformerProto) { + return mergeFrom((org.tribuo.protos.core.TransformerProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.TransformerProto other) { + if (other == org.tribuo.protos.core.TransformerProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasSerializedData()) { + mergeSerializedData(other.getSerializedData()); + } + 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 { + org.tribuo.protos.core.TransformerProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.TransformerProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Any serializedData_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> serializedDataBuilder_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + public boolean hasSerializedData() { + return serializedDataBuilder_ != null || serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + public com.google.protobuf.Any getSerializedData() { + if (serializedDataBuilder_ == null) { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } else { + return serializedDataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + serializedData_ = value; + onChanged(); + } else { + serializedDataBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData( + com.google.protobuf.Any.Builder builderForValue) { + if (serializedDataBuilder_ == null) { + serializedData_ = builderForValue.build(); + onChanged(); + } else { + serializedDataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder mergeSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (serializedData_ != null) { + serializedData_ = + com.google.protobuf.Any.newBuilder(serializedData_).mergeFrom(value).buildPartial(); + } else { + serializedData_ = value; + } + onChanged(); + } else { + serializedDataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder clearSerializedData() { + if (serializedDataBuilder_ == null) { + serializedData_ = null; + onChanged(); + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.Any.Builder getSerializedDataBuilder() { + + onChanged(); + return getSerializedDataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + if (serializedDataBuilder_ != null) { + return serializedDataBuilder_.getMessageOrBuilder(); + } else { + return serializedData_ == null ? + com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> + getSerializedDataFieldBuilder() { + if (serializedDataBuilder_ == null) { + serializedDataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( + getSerializedData(), + getParentForChildren(), + isClean()); + serializedData_ = null; + } + return serializedDataBuilder_; + } + @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:tribuo.core.TransformerProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.TransformerProto) + private static final org.tribuo.protos.core.TransformerProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.TransformerProto(); + } + + public static org.tribuo.protos.core.TransformerProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TransformerProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TransformerProto(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 org.tribuo.protos.core.TransformerProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/TransformerProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/TransformerProtoOrBuilder.java new file mode 100644 index 000000000..caaf70124 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/TransformerProtoOrBuilder.java @@ -0,0 +1,42 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface TransformerProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.TransformerProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + boolean hasSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + com.google.protobuf.Any getSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + */ + com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/core/TribuoCore.java b/Core/src/main/java/org/tribuo/protos/core/TribuoCore.java new file mode 100644 index 000000000..fb5101ad2 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/TribuoCore.java @@ -0,0 +1,317 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public final class TribuoCore { + private TribuoCore() {} + 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_tribuo_core_ModelProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_ModelProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_OutputFactoryProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_OutputFactoryProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_FeatureDomainProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_FeatureDomainProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_VariableInfoProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_VariableInfoProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_OutputDomainProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_OutputDomainProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_ModelDataProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_ModelDataProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_OutputProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_OutputProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_ExampleProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_ExampleProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_ExampleProto_MetadataEntry_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_ExampleProto_MetadataEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_DatasetProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_DatasetProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_PredictionProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_PredictionProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_PredictionProto_OutputScoresEntry_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_PredictionProto_OutputScoresEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_EnsembleCombinerProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_EnsembleCombinerProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_TransformerProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_TransformerProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_TransformerListProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_TransformerListProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_TransformerMapProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_TransformerMapProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_TransformerMapProto_TransformersEntry_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_TransformerMapProto_TransformersEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_HasherProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_HasherProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_MeanVarianceProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_MeanVarianceProto_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\021tribuo-core.proto\022\013tribuo.core\032\031google" + + "/protobuf/any.proto\032\021olcut_proto.proto\"\234" + + "\002\n\nModelProto\022\017\n\007version\030\001 \001(\005\022\014\n\004name\030\002" + + " \001(\t\022.\n\nprovenance\030\003 \001(\0132\032.olcut.RootPro" + + "venanceProto\022\036\n\026generate_probabilities\030\004" + + " \001(\010\0227\n\016feature_domain\030\005 \001(\0132\037.tribuo.co" + + "re.FeatureDomainProto\0225\n\routput_domain\030\006" + + " \001(\0132\036.tribuo.core.OutputDomainProto\022/\n\n" + + "model_data\030\007 \001(\0132\033.tribuo.core.ModelData" + + "Proto\"h\n\022OutputFactoryProto\022\017\n\007version\030\001" + + " \001(\005\022\022\n\nclass_name\030\002 \001(\t\022-\n\017serialized_d" + + "ata\030\003 \001(\0132\024.google.protobuf.Any\"h\n\022Featu" + + "reDomainProto\022\017\n\007version\030\001 \001(\005\022\022\n\nclass_" + + "name\030\002 \001(\t\022-\n\017serialized_data\030\003 \001(\0132\024.go" + + "ogle.protobuf.Any\"g\n\021VariableInfoProto\022\017" + + "\n\007version\030\001 \001(\005\022\022\n\nclass_name\030\002 \001(\t\022-\n\017s" + + "erialized_data\030\003 \001(\0132\024.google.protobuf.A" + + "ny\"g\n\021OutputDomainProto\022\017\n\007version\030\001 \001(\005" + + "\022\022\n\nclass_name\030\002 \001(\t\022-\n\017serialized_data\030" + + "\003 \001(\0132\024.google.protobuf.Any\"d\n\016ModelData" + + "Proto\022\017\n\007version\030\001 \001(\005\022\022\n\nclass_name\030\002 \001" + + "(\t\022-\n\017serialized_data\030\003 \001(\0132\024.google.pro" + + "tobuf.Any\"a\n\013OutputProto\022\017\n\007version\030\001 \001(" + + "\005\022\022\n\nclass_name\030\002 \001(\t\022-\n\017serialized_data" + + "\030\003 \001(\0132\024.google.protobuf.Any\"\366\001\n\014Example" + + "Proto\022\017\n\007version\030\001 \001(\005\022\022\n\nclass_name\030\002 \001" + + "(\t\022(\n\006output\030\003 \001(\0132\030.tribuo.core.OutputP" + + "roto\022\024\n\014feature_name\030\004 \003(\t\022\025\n\rfeature_va" + + "lue\030\005 \003(\001\0229\n\010metadata\030\006 \003(\0132\'.tribuo.cor" + + "e.ExampleProto.MetadataEntry\032/\n\rMetadata" + + "Entry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\272\002" + + "\n\014DatasetProto\022\017\n\007version\030\001 \001(\005\022\022\n\nclass" + + "_name\030\002 \001(\t\022.\n\nprovenance\030\003 \001(\0132\032.olcut." + + "RootProvenanceProto\0227\n\016feature_domain\030\004 " + + "\001(\0132\037.tribuo.core.FeatureDomainProto\0225\n\r" + + "output_domain\030\005 \001(\0132\036.tribuo.core.Output" + + "DomainProto\022+\n\010examples\030\006 \003(\0132\031.tribuo.c" + + "ore.ExampleProto\0228\n\024transform_provenance" + + "\030\007 \001(\0132\032.olcut.ListProvenanceProto\"\337\002\n\017P" + + "redictionProto\022\017\n\007version\030\001 \001(\005\022\022\n\nclass" + + "_name\030\002 \001(\t\022*\n\007example\030\003 \001(\0132\031.tribuo.co" + + "re.ExampleProto\022(\n\006output\030\004 \001(\0132\030.tribuo" + + ".core.OutputProto\022\023\n\013probability\030\005 \001(\010\022\020" + + "\n\010num_used\030\006 \001(\005\022\024\n\014example_size\030\007 \001(\005\022E" + + "\n\routput_scores\030\010 \003(\0132..tribuo.core.Pred" + + "ictionProto.OutputScoresEntry\032M\n\021OutputS" + + "coresEntry\022\013\n\003key\030\001 \001(\t\022\'\n\005value\030\002 \001(\0132\030" + + ".tribuo.core.OutputProto:\0028\001\"k\n\025Ensemble" + + "CombinerProto\022\017\n\007version\030\001 \001(\005\022\022\n\nclass_" + + "name\030\002 \001(\t\022-\n\017serialized_data\030\003 \001(\0132\024.go" + + "ogle.protobuf.Any\"f\n\020TransformerProto\022\017\n" + + "\007version\030\001 \001(\005\022\022\n\nclass_name\030\002 \001(\t\022-\n\017se" + + "rialized_data\030\003 \001(\0132\024.google.protobuf.An" + + "y\"J\n\024TransformerListProto\0222\n\013transformer" + + "\030\001 \003(\0132\035.tribuo.core.TransformerProto\"\300\002" + + "\n\023TransformerMapProto\022\017\n\007version\030\001 \001(\005\022H" + + "\n\014transformers\030\002 \003(\01322.tribuo.core.Trans" + + "formerMapProto.TransformersEntry\0225\n\021data" + + "setProvenance\030\003 \001(\0132\032.olcut.RootProvenan" + + "ceProto\022?\n\033transformationMapProvenance\030\004" + + " \001(\0132\032.olcut.RootProvenanceProto\032V\n\021Tran" + + "sformersEntry\022\013\n\003key\030\001 \001(\t\0220\n\005value\030\002 \001(" + + "\0132!.tribuo.core.TransformerListProto:\0028\001" + + "\"a\n\013HasherProto\022\017\n\007version\030\001 \001(\005\022\022\n\nclas" + + "s_name\030\002 \001(\t\022-\n\017serialized_data\030\003 \001(\0132\024." + + "google.protobuf.Any\"o\n\021MeanVarianceProto" + + "\022\017\n\007version\030\001 \001(\005\022\013\n\003max\030\002 \001(\001\022\013\n\003min\030\003 " + + "\001(\001\022\014\n\004mean\030\004 \001(\001\022\022\n\nsumSquares\030\005 \001(\001\022\r\n" + + "\005count\030\006 \001(\003B\032\n\026org.tribuo.protos.coreP\001" + + "b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.protobuf.AnyProto.getDescriptor(), + com.oracle.labs.mlrg.olcut.config.protobuf.protos.OlcutProto.getDescriptor(), + }); + internal_static_tribuo_core_ModelProto_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_tribuo_core_ModelProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_ModelProto_descriptor, + new java.lang.String[] { "Version", "Name", "Provenance", "GenerateProbabilities", "FeatureDomain", "OutputDomain", "ModelData", }); + internal_static_tribuo_core_OutputFactoryProto_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_tribuo_core_OutputFactoryProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_OutputFactoryProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "SerializedData", }); + internal_static_tribuo_core_FeatureDomainProto_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_tribuo_core_FeatureDomainProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_FeatureDomainProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "SerializedData", }); + internal_static_tribuo_core_VariableInfoProto_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_tribuo_core_VariableInfoProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_VariableInfoProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "SerializedData", }); + internal_static_tribuo_core_OutputDomainProto_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_tribuo_core_OutputDomainProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_OutputDomainProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "SerializedData", }); + internal_static_tribuo_core_ModelDataProto_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_tribuo_core_ModelDataProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_ModelDataProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "SerializedData", }); + internal_static_tribuo_core_OutputProto_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_tribuo_core_OutputProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_OutputProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "SerializedData", }); + internal_static_tribuo_core_ExampleProto_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_tribuo_core_ExampleProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_ExampleProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "Output", "FeatureName", "FeatureValue", "Metadata", }); + internal_static_tribuo_core_ExampleProto_MetadataEntry_descriptor = + internal_static_tribuo_core_ExampleProto_descriptor.getNestedTypes().get(0); + internal_static_tribuo_core_ExampleProto_MetadataEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_ExampleProto_MetadataEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_tribuo_core_DatasetProto_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_tribuo_core_DatasetProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_DatasetProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "Provenance", "FeatureDomain", "OutputDomain", "Examples", "TransformProvenance", }); + internal_static_tribuo_core_PredictionProto_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_tribuo_core_PredictionProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_PredictionProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "Example", "Output", "Probability", "NumUsed", "ExampleSize", "OutputScores", }); + internal_static_tribuo_core_PredictionProto_OutputScoresEntry_descriptor = + internal_static_tribuo_core_PredictionProto_descriptor.getNestedTypes().get(0); + internal_static_tribuo_core_PredictionProto_OutputScoresEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_PredictionProto_OutputScoresEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_tribuo_core_EnsembleCombinerProto_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_tribuo_core_EnsembleCombinerProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_EnsembleCombinerProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "SerializedData", }); + internal_static_tribuo_core_TransformerProto_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_tribuo_core_TransformerProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_TransformerProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "SerializedData", }); + internal_static_tribuo_core_TransformerListProto_descriptor = + getDescriptor().getMessageTypes().get(12); + internal_static_tribuo_core_TransformerListProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_TransformerListProto_descriptor, + new java.lang.String[] { "Transformer", }); + internal_static_tribuo_core_TransformerMapProto_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_tribuo_core_TransformerMapProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_TransformerMapProto_descriptor, + new java.lang.String[] { "Version", "Transformers", "DatasetProvenance", "TransformationMapProvenance", }); + internal_static_tribuo_core_TransformerMapProto_TransformersEntry_descriptor = + internal_static_tribuo_core_TransformerMapProto_descriptor.getNestedTypes().get(0); + internal_static_tribuo_core_TransformerMapProto_TransformersEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_TransformerMapProto_TransformersEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_tribuo_core_HasherProto_descriptor = + getDescriptor().getMessageTypes().get(14); + internal_static_tribuo_core_HasherProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_HasherProto_descriptor, + new java.lang.String[] { "Version", "ClassName", "SerializedData", }); + internal_static_tribuo_core_MeanVarianceProto_descriptor = + getDescriptor().getMessageTypes().get(15); + internal_static_tribuo_core_MeanVarianceProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_MeanVarianceProto_descriptor, + new java.lang.String[] { "Version", "Max", "Min", "Mean", "SumSquares", "Count", }); + com.google.protobuf.AnyProto.getDescriptor(); + com.oracle.labs.mlrg.olcut.config.protobuf.protos.OlcutProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/Core/src/main/java/org/tribuo/protos/core/TribuoCoreImpl.java b/Core/src/main/java/org/tribuo/protos/core/TribuoCoreImpl.java new file mode 100644 index 000000000..dbb49e8a0 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/TribuoCoreImpl.java @@ -0,0 +1,242 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core-impl.proto + +package org.tribuo.protos.core; + +public final class TribuoCoreImpl { + private TribuoCoreImpl() {} + 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_tribuo_core_HashedFeatureMapProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_HashedFeatureMapProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_ImmutableFeatureMapProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_ImmutableFeatureMapProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_MutableFeatureMapProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_MutableFeatureMapProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_RealInfoProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_RealInfoProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_RealIDInfoProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_RealIDInfoProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_CategoricalInfoProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_CategoricalInfoProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_CategoricalIDInfoProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_CategoricalIDInfoProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_MessageDigestHasherProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_MessageDigestHasherProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_ModHashCodeHasherProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_ModHashCodeHasherProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_SimpleTransformProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_SimpleTransformProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_MeanStdDevTransformerProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_MeanStdDevTransformerProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_LinearScalingTransformerProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_LinearScalingTransformerProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_IDFTransformerProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_IDFTransformerProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_BinningTransformerProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_BinningTransformerProto_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_tribuo_core_TestCountTransformerProto_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_tribuo_core_TestCountTransformerProto_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\026tribuo-core-impl.proto\022\013tribuo.core\032\021t" + + "ribuo-core.proto\032\021olcut_proto.proto\"o\n\025H" + + "ashedFeatureMapProto\022(\n\006hasher\030\001 \001(\0132\030.t" + + "ribuo.core.HasherProto\022,\n\004info\030\002 \003(\0132\036.t" + + "ribuo.core.VariableInfoProto\"H\n\030Immutabl" + + "eFeatureMapProto\022,\n\004info\030\001 \003(\0132\036.tribuo." + + "core.VariableInfoProto\"h\n\026MutableFeature" + + "MapProto\022 \n\030convert_high_cardinality\030\001 \001" + + "(\010\022,\n\004info\030\002 \003(\0132\036.tribuo.core.VariableI" + + "nfoProto\"h\n\rRealInfoProto\022\014\n\004name\030\001 \001(\t\022" + + "\r\n\005count\030\002 \001(\005\022\013\n\003max\030\n \001(\001\022\013\n\003min\030\013 \001(\001" + + "\022\014\n\004mean\030\014 \001(\001\022\022\n\nsumSquares\030\r \001(\001\"v\n\017Re" + + "alIDInfoProto\022\014\n\004name\030\001 \001(\t\022\r\n\005count\030\002 \001" + + "(\005\022\n\n\002id\030\003 \001(\005\022\013\n\003max\030\n \001(\001\022\013\n\003min\030\013 \001(\001" + + "\022\014\n\004mean\030\014 \001(\001\022\022\n\nsumSquares\030\r \001(\001\"\177\n\024Ca" + + "tegoricalInfoProto\022\014\n\004name\030\001 \001(\t\022\r\n\005coun" + + "t\030\002 \001(\005\022\013\n\003key\030\n \003(\001\022\r\n\005value\030\013 \003(\003\022\026\n\016o" + + "bserved_value\030\014 \001(\001\022\026\n\016observed_count\030\r " + + "\001(\003\"\215\001\n\026CategoricalIDInfoProto\022\014\n\004name\030\001" + + " \001(\t\022\r\n\005count\030\002 \001(\005\022\n\n\002id\030\003 \001(\005\022\013\n\003key\030\n" + + " \003(\001\022\r\n\005value\030\013 \003(\003\022\026\n\016observed_value\030\014 " + + "\001(\001\022\026\n\016observed_count\030\r \001(\003\"-\n\030MessageDi" + + "gestHasherProto\022\021\n\thash_type\030\001 \001(\t\"+\n\026Mo" + + "dHashCodeHasherProto\022\021\n\tdimension\030\001 \001(\005\"" + + "Q\n\024SimpleTransformProto\022\n\n\002op\030\001 \001(\t\022\025\n\rf" + + "irst_operand\030\002 \001(\001\022\026\n\016second_operand\030\003 \001" + + "(\001\"t\n\032MeanStdDevTransformerProto\022\024\n\014obse" + + "rvedMean\030\001 \001(\001\022\026\n\016observedStdDev\030\002 \001(\001\022\022" + + "\n\ntargetMean\030\003 \001(\001\022\024\n\014targetStdDev\030\004 \001(\001" + + "\"o\n\035LinearScalingTransformerProto\022\023\n\013obs" + + "ervedMin\030\001 \001(\001\022\023\n\013observedMax\030\002 \001(\001\022\021\n\tt" + + "argetMin\030\003 \001(\001\022\021\n\ttargetMax\030\004 \001(\001\",\n\023IDF" + + "TransformerProto\022\n\n\002df\030\001 \001(\001\022\t\n\001N\030\002 \001(\001\"" + + "M\n\027BinningTransformerProto\022\024\n\014binning_ty" + + "pe\030\001 \001(\t\022\014\n\004bins\030\002 \003(\001\022\016\n\006values\030\003 \003(\001\"m" + + "\n\031TestCountTransformerProto\022\r\n\005count\030\001 \001" + + "(\005\022\023\n\013sparseCount\030\002 \001(\005\022\024\n\014countMapKeys\030" + + "\003 \003(\001\022\026\n\016countMapValues\030\004 \003(\003B\032\n\026org.tri" + + "buo.protos.coreP\001b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + org.tribuo.protos.core.TribuoCore.getDescriptor(), + com.oracle.labs.mlrg.olcut.config.protobuf.protos.OlcutProto.getDescriptor(), + }); + internal_static_tribuo_core_HashedFeatureMapProto_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_tribuo_core_HashedFeatureMapProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_HashedFeatureMapProto_descriptor, + new java.lang.String[] { "Hasher", "Info", }); + internal_static_tribuo_core_ImmutableFeatureMapProto_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_tribuo_core_ImmutableFeatureMapProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_ImmutableFeatureMapProto_descriptor, + new java.lang.String[] { "Info", }); + internal_static_tribuo_core_MutableFeatureMapProto_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_tribuo_core_MutableFeatureMapProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_MutableFeatureMapProto_descriptor, + new java.lang.String[] { "ConvertHighCardinality", "Info", }); + internal_static_tribuo_core_RealInfoProto_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_tribuo_core_RealInfoProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_RealInfoProto_descriptor, + new java.lang.String[] { "Name", "Count", "Max", "Min", "Mean", "SumSquares", }); + internal_static_tribuo_core_RealIDInfoProto_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_tribuo_core_RealIDInfoProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_RealIDInfoProto_descriptor, + new java.lang.String[] { "Name", "Count", "Id", "Max", "Min", "Mean", "SumSquares", }); + internal_static_tribuo_core_CategoricalInfoProto_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_tribuo_core_CategoricalInfoProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_CategoricalInfoProto_descriptor, + new java.lang.String[] { "Name", "Count", "Key", "Value", "ObservedValue", "ObservedCount", }); + internal_static_tribuo_core_CategoricalIDInfoProto_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_tribuo_core_CategoricalIDInfoProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_CategoricalIDInfoProto_descriptor, + new java.lang.String[] { "Name", "Count", "Id", "Key", "Value", "ObservedValue", "ObservedCount", }); + internal_static_tribuo_core_MessageDigestHasherProto_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_tribuo_core_MessageDigestHasherProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_MessageDigestHasherProto_descriptor, + new java.lang.String[] { "HashType", }); + internal_static_tribuo_core_ModHashCodeHasherProto_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_tribuo_core_ModHashCodeHasherProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_ModHashCodeHasherProto_descriptor, + new java.lang.String[] { "Dimension", }); + internal_static_tribuo_core_SimpleTransformProto_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_tribuo_core_SimpleTransformProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_SimpleTransformProto_descriptor, + new java.lang.String[] { "Op", "FirstOperand", "SecondOperand", }); + internal_static_tribuo_core_MeanStdDevTransformerProto_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_tribuo_core_MeanStdDevTransformerProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_MeanStdDevTransformerProto_descriptor, + new java.lang.String[] { "ObservedMean", "ObservedStdDev", "TargetMean", "TargetStdDev", }); + internal_static_tribuo_core_LinearScalingTransformerProto_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_tribuo_core_LinearScalingTransformerProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_LinearScalingTransformerProto_descriptor, + new java.lang.String[] { "ObservedMin", "ObservedMax", "TargetMin", "TargetMax", }); + internal_static_tribuo_core_IDFTransformerProto_descriptor = + getDescriptor().getMessageTypes().get(12); + internal_static_tribuo_core_IDFTransformerProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_IDFTransformerProto_descriptor, + new java.lang.String[] { "Df", "N", }); + internal_static_tribuo_core_BinningTransformerProto_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_tribuo_core_BinningTransformerProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_BinningTransformerProto_descriptor, + new java.lang.String[] { "BinningType", "Bins", "Values", }); + internal_static_tribuo_core_TestCountTransformerProto_descriptor = + getDescriptor().getMessageTypes().get(14); + internal_static_tribuo_core_TestCountTransformerProto_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_tribuo_core_TestCountTransformerProto_descriptor, + new java.lang.String[] { "Count", "SparseCount", "CountMapKeys", "CountMapValues", }); + org.tribuo.protos.core.TribuoCore.getDescriptor(); + com.oracle.labs.mlrg.olcut.config.protobuf.protos.OlcutProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/Core/src/main/java/org/tribuo/protos/core/VariableInfoProto.java b/Core/src/main/java/org/tribuo/protos/core/VariableInfoProto.java new file mode 100644 index 000000000..293149caf --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/VariableInfoProto.java @@ -0,0 +1,819 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +/** + *
+ *Feature info redirection proto
+ * 
+ * + * Protobuf type {@code tribuo.core.VariableInfoProto} + */ +public final class VariableInfoProto extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:tribuo.core.VariableInfoProto) + VariableInfoProtoOrBuilder { +private static final long serialVersionUID = 0L; + // Use VariableInfoProto.newBuilder() to construct. + private VariableInfoProto(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private VariableInfoProto() { + className_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new VariableInfoProto(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private VariableInfoProto( + 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: { + + version_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + com.google.protobuf.Any.Builder subBuilder = null; + if (serializedData_ != null) { + subBuilder = serializedData_.toBuilder(); + } + serializedData_ = input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(serializedData_); + serializedData_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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 org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_VariableInfoProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_VariableInfoProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.VariableInfoProto.class, org.tribuo.protos.core.VariableInfoProto.Builder.class); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + + public static final int CLASS_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object className_; + /** + * string class_name = 2; + * @return The className. + */ + @java.lang.Override + public java.lang.String getClassName() { + java.lang.Object ref = className_; + 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(); + className_ = s; + return s; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERIALIZED_DATA_FIELD_NUMBER = 3; + private com.google.protobuf.Any serializedData_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + @java.lang.Override + public boolean hasSerializedData() { + return serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + @java.lang.Override + public com.google.protobuf.Any getSerializedData() { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + @java.lang.Override + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + return getSerializedData(); + } + + 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 (version_ != 0) { + output.writeInt32(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (serializedData_ != null) { + output.writeMessage(3, getSerializedData()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, version_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(className_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (serializedData_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getSerializedData()); + } + 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 org.tribuo.protos.core.VariableInfoProto)) { + return super.equals(obj); + } + org.tribuo.protos.core.VariableInfoProto other = (org.tribuo.protos.core.VariableInfoProto) obj; + + if (getVersion() + != other.getVersion()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (hasSerializedData() != other.hasSerializedData()) return false; + if (hasSerializedData()) { + if (!getSerializedData() + .equals(other.getSerializedData())) 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) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + if (hasSerializedData()) { + hash = (37 * hash) + SERIALIZED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getSerializedData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.tribuo.protos.core.VariableInfoProto parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.VariableInfoProto parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.VariableInfoProto parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.VariableInfoProto parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.VariableInfoProto parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.tribuo.protos.core.VariableInfoProto parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.tribuo.protos.core.VariableInfoProto parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.VariableInfoProto 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 org.tribuo.protos.core.VariableInfoProto parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.VariableInfoProto 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 org.tribuo.protos.core.VariableInfoProto parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.tribuo.protos.core.VariableInfoProto 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(org.tribuo.protos.core.VariableInfoProto 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; + } + /** + *
+   *Feature info redirection proto
+   * 
+ * + * Protobuf type {@code tribuo.core.VariableInfoProto} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:tribuo.core.VariableInfoProto) + org.tribuo.protos.core.VariableInfoProtoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_VariableInfoProto_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_VariableInfoProto_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.tribuo.protos.core.VariableInfoProto.class, org.tribuo.protos.core.VariableInfoProto.Builder.class); + } + + // Construct using org.tribuo.protos.core.VariableInfoProto.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(); + version_ = 0; + + className_ = ""; + + if (serializedDataBuilder_ == null) { + serializedData_ = null; + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.tribuo.protos.core.TribuoCore.internal_static_tribuo_core_VariableInfoProto_descriptor; + } + + @java.lang.Override + public org.tribuo.protos.core.VariableInfoProto getDefaultInstanceForType() { + return org.tribuo.protos.core.VariableInfoProto.getDefaultInstance(); + } + + @java.lang.Override + public org.tribuo.protos.core.VariableInfoProto build() { + org.tribuo.protos.core.VariableInfoProto result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.tribuo.protos.core.VariableInfoProto buildPartial() { + org.tribuo.protos.core.VariableInfoProto result = new org.tribuo.protos.core.VariableInfoProto(this); + result.version_ = version_; + result.className_ = className_; + if (serializedDataBuilder_ == null) { + result.serializedData_ = serializedData_; + } else { + result.serializedData_ = serializedDataBuilder_.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 org.tribuo.protos.core.VariableInfoProto) { + return mergeFrom((org.tribuo.protos.core.VariableInfoProto)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.tribuo.protos.core.VariableInfoProto other) { + if (other == org.tribuo.protos.core.VariableInfoProto.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.hasSerializedData()) { + mergeSerializedData(other.getSerializedData()); + } + 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 { + org.tribuo.protos.core.VariableInfoProto parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.tribuo.protos.core.VariableInfoProto) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int version_ ; + /** + * int32 version = 1; + * @return The version. + */ + @java.lang.Override + public int getVersion() { + return version_; + } + /** + * int32 version = 1; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * int32 version = 1; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object className_ = ""; + /** + * string class_name = 2; + * @return The className. + */ + public java.lang.String getClassName() { + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string class_name = 2; + * @return The bytes for className. + */ + public com.google.protobuf.ByteString + getClassNameBytes() { + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string class_name = 2; + * @param value The className to set. + * @return This builder for chaining. + */ + public Builder setClassName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); + return this; + } + /** + * string class_name = 2; + * @return This builder for chaining. + */ + public Builder clearClassName() { + + className_ = getDefaultInstance().getClassName(); + onChanged(); + return this; + } + /** + * string class_name = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. + */ + public Builder setClassNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Any serializedData_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> serializedDataBuilder_; + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + public boolean hasSerializedData() { + return serializedDataBuilder_ != null || serializedData_ != null; + } + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + public com.google.protobuf.Any getSerializedData() { + if (serializedDataBuilder_ == null) { + return serializedData_ == null ? com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } else { + return serializedDataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + serializedData_ = value; + onChanged(); + } else { + serializedDataBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder setSerializedData( + com.google.protobuf.Any.Builder builderForValue) { + if (serializedDataBuilder_ == null) { + serializedData_ = builderForValue.build(); + onChanged(); + } else { + serializedDataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder mergeSerializedData(com.google.protobuf.Any value) { + if (serializedDataBuilder_ == null) { + if (serializedData_ != null) { + serializedData_ = + com.google.protobuf.Any.newBuilder(serializedData_).mergeFrom(value).buildPartial(); + } else { + serializedData_ = value; + } + onChanged(); + } else { + serializedDataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public Builder clearSerializedData() { + if (serializedDataBuilder_ == null) { + serializedData_ = null; + onChanged(); + } else { + serializedData_ = null; + serializedDataBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.Any.Builder getSerializedDataBuilder() { + + onChanged(); + return getSerializedDataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + public com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder() { + if (serializedDataBuilder_ != null) { + return serializedDataBuilder_.getMessageOrBuilder(); + } else { + return serializedData_ == null ? + com.google.protobuf.Any.getDefaultInstance() : serializedData_; + } + } + /** + * .google.protobuf.Any serialized_data = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> + getSerializedDataFieldBuilder() { + if (serializedDataBuilder_ == null) { + serializedDataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( + getSerializedData(), + getParentForChildren(), + isClean()); + serializedData_ = null; + } + return serializedDataBuilder_; + } + @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:tribuo.core.VariableInfoProto) + } + + // @@protoc_insertion_point(class_scope:tribuo.core.VariableInfoProto) + private static final org.tribuo.protos.core.VariableInfoProto DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.tribuo.protos.core.VariableInfoProto(); + } + + public static org.tribuo.protos.core.VariableInfoProto getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public VariableInfoProto parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new VariableInfoProto(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 org.tribuo.protos.core.VariableInfoProto getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/Core/src/main/java/org/tribuo/protos/core/VariableInfoProtoOrBuilder.java b/Core/src/main/java/org/tribuo/protos/core/VariableInfoProtoOrBuilder.java new file mode 100644 index 000000000..c784ea274 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/core/VariableInfoProtoOrBuilder.java @@ -0,0 +1,42 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tribuo-core.proto + +package org.tribuo.protos.core; + +public interface VariableInfoProtoOrBuilder extends + // @@protoc_insertion_point(interface_extends:tribuo.core.VariableInfoProto) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 version = 1; + * @return The version. + */ + int getVersion(); + + /** + * string class_name = 2; + * @return The className. + */ + java.lang.String getClassName(); + /** + * string class_name = 2; + * @return The bytes for className. + */ + com.google.protobuf.ByteString + getClassNameBytes(); + + /** + * .google.protobuf.Any serialized_data = 3; + * @return Whether the serializedData field is set. + */ + boolean hasSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + * @return The serializedData. + */ + com.google.protobuf.Any getSerializedData(); + /** + * .google.protobuf.Any serialized_data = 3; + */ + com.google.protobuf.AnyOrBuilder getSerializedDataOrBuilder(); +} diff --git a/Core/src/main/java/org/tribuo/protos/package-info.java b/Core/src/main/java/org/tribuo/protos/package-info.java new file mode 100644 index 000000000..ffa78b014 --- /dev/null +++ b/Core/src/main/java/org/tribuo/protos/package-info.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Classes which control the serialization of Tribuo objects to and from protocol buffers. + *

+ * There is an automatic serialization mechanism which requires the fields to be + * annotated with {@link org.tribuo.protos.ProtoSerializableField} and similar. The + * enclosing class must implement {@link org.tribuo.protos.ProtoSerializable} and + * be annotated with {@link org.tribuo.protos.ProtoSerializableClass}. This mechanism + * can serialize: + *

    + *
  • primitive types
  • + *
  • Strings
  • + *
  • classes which implement {@link org.tribuo.protos.ProtoSerializable}
  • + *
  • lists, sets and maps of supported types
  • + *
+ *

+ * Maps may be serialized in multiple ways, as protobuf does not support the full set of + * map type parameters that Java does. The variants are: + *

    + *
  • Using the standard {@link org.tribuo.protos.ProtoSerializableField} annotation directly serializes the map as a protobuf map
  • + *
  • {@link org.tribuo.protos.ProtoSerializableKeysValuesField} serializes the map as two repeated fields for the keys and values
  • + *
  • {@link org.tribuo.protos.ProtoSerializableMapValuesField} serializes just the values from the map
  • + *
+ */ +package org.tribuo.protos; \ No newline at end of file diff --git a/Core/src/main/java/org/tribuo/transform/Transformer.java b/Core/src/main/java/org/tribuo/transform/Transformer.java index 2f3c3baa0..0352d1333 100644 --- a/Core/src/main/java/org/tribuo/transform/Transformer.java +++ b/Core/src/main/java/org/tribuo/transform/Transformer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,10 @@ package org.tribuo.transform; +import org.tribuo.protos.core.TransformerProto; +import org.tribuo.protos.ProtoSerializable; +import org.tribuo.protos.ProtoUtil; + import java.io.Serializable; /** @@ -26,7 +30,7 @@ * Transformers are serializable, and should only * be constructed by their {@link TransformStatistics}. */ -public interface Transformer extends Serializable { +public interface Transformer extends ProtoSerializable, Serializable { /** * Applies the transformation to the supplied @@ -36,4 +40,12 @@ public interface Transformer extends Serializable { */ public double transform(double input); + /** + * Deserializes a {@link TransformerProto} into a {@link Transformer} subclass. + * @param proto The proto to deserialize. + * @return The deserialized FeatureMap. + */ + public static Transformer deserialize(TransformerProto proto) { + return ProtoUtil.deserialize(proto); + } } diff --git a/Core/src/main/java/org/tribuo/transform/TransformerMap.java b/Core/src/main/java/org/tribuo/transform/TransformerMap.java index 624df19cb..2e86fbd76 100644 --- a/Core/src/main/java/org/tribuo/transform/TransformerMap.java +++ b/Core/src/main/java/org/tribuo/transform/TransformerMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.oracle.labs.mlrg.olcut.provenance.ObjectProvenance; import com.oracle.labs.mlrg.olcut.provenance.Provenancable; import com.oracle.labs.mlrg.olcut.provenance.Provenance; +import com.oracle.labs.mlrg.olcut.provenance.ProvenanceUtil; import com.oracle.labs.mlrg.olcut.provenance.primitives.StringProvenance; import com.oracle.labs.mlrg.olcut.util.Pair; import org.tribuo.Dataset; @@ -27,6 +28,11 @@ import org.tribuo.MutableDataset; import org.tribuo.Output; import org.tribuo.impl.ArrayExample; +import org.tribuo.protos.ProtoSerializable; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.TransformerListProto; +import org.tribuo.protos.core.TransformerMapProto; +import org.tribuo.protos.core.TransformerProto; import org.tribuo.provenance.DatasetProvenance; import org.tribuo.transform.TransformerMap.TransformerMapProvenance; @@ -34,6 +40,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -51,12 +58,18 @@ * first call {@link MutableDataset#densify} on the datasets. * See {@link org.tribuo.transform} for a more detailed discussion of densify. */ -public final class TransformerMap implements Provenancable, Serializable { - +public final class TransformerMap implements ProtoSerializable, + Provenancable, Serializable { + private static final Logger logger = Logger.getLogger(TransformerMap.class.getName()); private static final long serialVersionUID = 2L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + private final Map> map; private final DatasetProvenance datasetProvenance; private final ConfiguredObjectProvenance transformationMapProvenance; @@ -73,6 +86,32 @@ public TransformerMap(Map> map, DatasetProvenance datas this.transformationMapProvenance = transformationMapProvenance; } + /** + * Deserializes a {@link TransformerMapProto} into a {@link TransformerMap}. + * @param proto The proto to deserialize. + * @return The deserialized TransformerMap. + */ + public static TransformerMap deserialize(TransformerMapProto proto) { + if (proto.getVersion() == CURRENT_VERSION) { + Map> map = new LinkedHashMap<>(); + for (Map.Entry e : proto.getTransformersMap().entrySet()) { + List list = new ArrayList<>(); + for (TransformerProto p : e.getValue().getTransformerList()) { + list.add(ProtoUtil.deserialize(p)); + } + map.put(e.getKey(),list); + } + DatasetProvenance datasetProvenance = (DatasetProvenance) ProvenanceUtil.unmarshalProvenance( + PROVENANCE_SERIALIZER.deserializeFromProto(proto.getDatasetProvenance())); + ConfiguredObjectProvenance transformationMapProvenance = (ConfiguredObjectProvenance) + ProvenanceUtil.unmarshalProvenance(PROVENANCE_SERIALIZER.deserializeFromProto( + proto.getTransformationMapProvenance())); + return new TransformerMap(map,datasetProvenance,transformationMapProvenance); + } else { + throw new IllegalArgumentException("Unknown version " + proto.getVersion() + " expected {0}"); + } + } + /** * Applies a {@link List} of {@link Transformer}s to the supplied double value, * returning the transformed value. @@ -135,7 +174,6 @@ public > MutableDataset transformDataset(Dataset datas * @return A deep copy of the dataset (and it's examples) with the transformers applied to it's features. */ public > MutableDataset transformDataset(Dataset dataset, boolean densify) { - logger.fine("Creating deep copy of data set"); MutableDataset newDataset = MutableDataset.createDeepCopy(dataset); @@ -161,9 +199,9 @@ public int size() { } /** - * Gets the transformer associated with a given feature name. + * Gets the transformers associated with a given feature name. * @param featureName the name of the feature for which we want the transformer - * @return the transformer associated with the feature name, which may be null + * @return the transformer list associated with the feature name, which may be null * if there is no feature with that name. */ public List get(String featureName) { @@ -175,6 +213,19 @@ public String toString() { return "TransformerMap(map="+map.toString()+")"; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + TransformerMap that = (TransformerMap) o; + return map.equals(that.map) && datasetProvenance.equals(that.datasetProvenance) && transformationMapProvenance.equals(that.transformationMapProvenance); + } + + @Override + public int hashCode() { + return Objects.hash(map, datasetProvenance, transformationMapProvenance); + } + /** * Get the feature names and associated list of transformers. * @return The entry set of the transformer map. @@ -188,6 +239,28 @@ public TransformerMapProvenance getProvenance() { return new TransformerMapProvenance(this); } + @Override + public TransformerMapProto serialize() { + TransformerMapProto.Builder builder = TransformerMapProto.newBuilder(); + + builder.setVersion(CURRENT_VERSION); + builder.setDatasetProvenance( + PROVENANCE_SERIALIZER.serializeToProto( + ProvenanceUtil.marshalProvenance(datasetProvenance))); + builder.setTransformationMapProvenance( + PROVENANCE_SERIALIZER.serializeToProto( + ProvenanceUtil.marshalProvenance(transformationMapProvenance))); + for (Map.Entry> e : map.entrySet()) { + TransformerListProto.Builder listBuilder = TransformerListProto.newBuilder(); + for (Transformer t : e.getValue()) { + listBuilder.addTransformer(t.serialize()); + } + builder.putTransformers(e.getKey(),listBuilder.build()); + } + + return builder.build(); + } + /** * Provenance for {@link TransformerMap}. */ diff --git a/Core/src/main/java/org/tribuo/transform/transformations/BinningTransformation.java b/Core/src/main/java/org/tribuo/transform/transformations/BinningTransformation.java index e8d31ffa4..eb3ff70e6 100644 --- a/Core/src/main/java/org/tribuo/transform/transformations/BinningTransformation.java +++ b/Core/src/main/java/org/tribuo/transform/transformations/BinningTransformation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,15 +16,23 @@ package org.tribuo.transform.transformations; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; import com.oracle.labs.mlrg.olcut.config.Config; import com.oracle.labs.mlrg.olcut.provenance.ObjectProvenance; import com.oracle.labs.mlrg.olcut.provenance.Provenance; import com.oracle.labs.mlrg.olcut.provenance.primitives.EnumProvenance; import com.oracle.labs.mlrg.olcut.provenance.primitives.IntProvenance; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.BinningTransformerProto; +import org.tribuo.protos.core.TransformerProto; import org.tribuo.transform.TransformStatistics; import org.tribuo.transform.Transformation; import org.tribuo.transform.TransformationProvenance; import org.tribuo.transform.Transformer; +import org.tribuo.util.Util; import java.util.Arrays; import java.util.Collections; @@ -434,19 +442,56 @@ public String toString() { } } - private static class BinningTransformer implements Transformer { + @ProtoSerializableClass(version = BinningTransformer.CURRENT_VERSION, serializedDataClass = BinningTransformerProto.class) + static final class BinningTransformer implements Transformer { private static final long serialVersionUID = 1L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + + @ProtoSerializableField(name = "binningType") private final BinningType type; + @ProtoSerializableField private final double[] bins; + @ProtoSerializableField private final double[] values; - public BinningTransformer(BinningType type, double[] bins, double[] values) { + BinningTransformer(BinningType type, double[] bins, double[] values) { + if (bins == null || bins.length == 0) { + throw new IllegalArgumentException("Invalid bin array"); + } + if (values == null || values.length == 0) { + throw new IllegalArgumentException("Invalid value array"); + } this.type = type; this.bins = bins; this.values = values; } + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + * @throws InvalidProtocolBufferException If the message is not a {@link BinningTransformerProto}. + */ + static BinningTransformer deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + BinningTransformerProto proto = message.unpack(BinningTransformerProto.class); + if (version == CURRENT_VERSION) { + if (proto.getBinsCount() == proto.getValuesCount()) { + double[] newBins = Util.toPrimitiveDouble(proto.getBinsList()); + double[] newValues = Util.toPrimitiveDouble(proto.getValuesList()); + return new BinningTransformer(BinningType.valueOf(proto.getBinningType()),newBins,newValues); + } else { + throw new IllegalArgumentException("Invalid protobuf, found a differing number of bins and values."); + } + } else { + throw new IllegalArgumentException("Unknown version " + version + " expected {0}"); + } + } + @Override public double transform(double input) { if (input > bins[bins.length-1]) { @@ -465,5 +510,27 @@ public double transform(double input) { public String toString() { return "BinningTransformer(type="+type+",bins="+Arrays.toString(bins)+",values="+Arrays.toString(values)+")"; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + BinningTransformer that = (BinningTransformer) o; + return type == that.type && Arrays.equals(bins, that.bins) && Arrays.equals(values, that.values); + } + + @Override + public int hashCode() { + int result = Objects.hash(type); + result = 31 * result + Arrays.hashCode(bins); + result = 31 * result + Arrays.hashCode(values); + return result; + } + + @Override + public TransformerProto serialize() { + return ProtoUtil.serialize(this); + } + } } diff --git a/Core/src/main/java/org/tribuo/transform/transformations/IDFTransformation.java b/Core/src/main/java/org/tribuo/transform/transformations/IDFTransformation.java index 2c44e31e8..e74eb406b 100644 --- a/Core/src/main/java/org/tribuo/transform/transformations/IDFTransformation.java +++ b/Core/src/main/java/org/tribuo/transform/transformations/IDFTransformation.java @@ -16,14 +16,23 @@ package org.tribuo.transform.transformations; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; import com.oracle.labs.mlrg.olcut.provenance.Provenance; -import java.util.Collections; -import java.util.Map; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.IDFTransformerProto; +import org.tribuo.protos.core.TransformerProto; import org.tribuo.transform.TransformStatistics; import org.tribuo.transform.Transformation; import org.tribuo.transform.TransformationProvenance; import org.tribuo.transform.Transformer; +import java.util.Collections; +import java.util.Map; +import java.util.Objects; + /** * A feature transformation that computes the IDF for features and then transforms * them with a TF-IDF weighting. @@ -90,11 +99,19 @@ public Transformer generateTransformer() { } - private static class IDFTransformer implements Transformer { + @ProtoSerializableClass(version = IDFTransformer.CURRENT_VERSION, serializedDataClass = IDFTransformerProto.class) + static class IDFTransformer implements Transformer { private static final long serialVersionUID = 1L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + + @ProtoSerializableField private final double df; + @ProtoSerializableField private final double N; /** @@ -102,16 +119,52 @@ private static class IDFTransformer implements Transformer { * @param df The document frequency. * @param N The number of documents. */ - public IDFTransformer(int df, int N) { + IDFTransformer(int df, int N) { + if ((df < 0) || (N < 0)) { + throw new IllegalArgumentException("Both df and N must be positive"); + } this.df = df; this.N = N; } + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + * @throws InvalidProtocolBufferException If the message is not a {@link IDFTransformerProto}. + */ + static IDFTransformer deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + IDFTransformerProto proto = message.unpack(IDFTransformerProto.class); + if (version == CURRENT_VERSION) { + return new IDFTransformer((int)proto.getDf(), (int)proto.getN()); + } else { + throw new IllegalArgumentException("Unknown version " + version + " expected {0}"); + } + } + @Override public double transform(double tf) { return Math.log(N / df) * (1 + Math.log(tf)); } - + + @Override + public TransformerProto serialize() { + return ProtoUtil.serialize(this); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + IDFTransformer that = (IDFTransformer) o; + return Double.compare(that.df, df) == 0 && Double.compare(that.N, N) == 0; + } + + @Override + public int hashCode() { + return Objects.hash(df, N); + } } /** diff --git a/Core/src/main/java/org/tribuo/transform/transformations/LinearScalingTransformation.java b/Core/src/main/java/org/tribuo/transform/transformations/LinearScalingTransformation.java index 1b66a2fc6..b60809843 100644 --- a/Core/src/main/java/org/tribuo/transform/transformations/LinearScalingTransformation.java +++ b/Core/src/main/java/org/tribuo/transform/transformations/LinearScalingTransformation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,17 @@ package org.tribuo.transform.transformations; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; import com.oracle.labs.mlrg.olcut.config.Config; import com.oracle.labs.mlrg.olcut.provenance.ObjectProvenance; import com.oracle.labs.mlrg.olcut.provenance.Provenance; import com.oracle.labs.mlrg.olcut.provenance.primitives.DoubleProvenance; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.LinearScalingTransformerProto; +import org.tribuo.protos.core.TransformerProto; import org.tribuo.transform.TransformStatistics; import org.tribuo.transform.Transformation; import org.tribuo.transform.TransformationProvenance; @@ -193,17 +200,30 @@ public String toString() { } } - private static class LinearScalingTransformer implements Transformer { + @ProtoSerializableClass(version = LinearScalingTransformer.CURRENT_VERSION, serializedDataClass = LinearScalingTransformerProto.class) + static final class LinearScalingTransformer implements Transformer { private static final long serialVersionUID = 1L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + + @ProtoSerializableField private final double observedMin; + @ProtoSerializableField private final double observedMax; + @ProtoSerializableField private final double targetMin; + @ProtoSerializableField private final double targetMax; private final double scalingFactor; private final boolean constant; - public LinearScalingTransformer(double observedMin, double observedMax, double targetMin, double targetMax) { + LinearScalingTransformer(double observedMin, double observedMax, double targetMin, double targetMax) { + if ((observedMin > observedMax) || (targetMin > targetMax)) { + throw new IllegalArgumentException("observedMin and targetMin must be less than observedMax and targetMax respectively"); + } this.observedMin = observedMin; this.observedMax = observedMax; this.targetMin = targetMin; @@ -214,6 +234,23 @@ public LinearScalingTransformer(double observedMin, double observedMax, double t this.scalingFactor = targetRange / observedRange; } + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + * @throws InvalidProtocolBufferException If the message is not a {@link LinearScalingTransformerProto}. + */ + static LinearScalingTransformer deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + LinearScalingTransformerProto proto = message.unpack(LinearScalingTransformerProto.class); + if (version == CURRENT_VERSION) { + return new LinearScalingTransformer(proto.getObservedMin(),proto.getObservedMax(), + proto.getTargetMin(),proto.getTargetMax()); + } else { + throw new IllegalArgumentException("Unknown version " + version + " expected {0}"); + } + } + @Override public double transform(double input) { if (constant) { @@ -228,9 +265,27 @@ public double transform(double input) { } } + @Override + public TransformerProto serialize() { + return ProtoUtil.serialize(this); + } + @Override public String toString() { return "LinearScalingTransformer(observedMin="+observedMin+",observedMax="+observedMax+",targetMin="+targetMin+",targetMax="+targetMax+")"; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + LinearScalingTransformer that = (LinearScalingTransformer) o; + return Double.compare(that.observedMin, observedMin) == 0 && Double.compare(that.observedMax, observedMax) == 0 && Double.compare(that.targetMin, targetMin) == 0 && Double.compare(that.targetMax, targetMax) == 0 && Double.compare(that.scalingFactor, scalingFactor) == 0 && constant == that.constant; + } + + @Override + public int hashCode() { + return Objects.hash(observedMin, observedMax, targetMin, targetMax, scalingFactor, constant); + } } } diff --git a/Core/src/main/java/org/tribuo/transform/transformations/MeanStdDevTransformation.java b/Core/src/main/java/org/tribuo/transform/transformations/MeanStdDevTransformation.java index cd84a8eb0..37c19d2ca 100644 --- a/Core/src/main/java/org/tribuo/transform/transformations/MeanStdDevTransformation.java +++ b/Core/src/main/java/org/tribuo/transform/transformations/MeanStdDevTransformation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,17 @@ package org.tribuo.transform.transformations; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; import com.oracle.labs.mlrg.olcut.config.Config; import com.oracle.labs.mlrg.olcut.provenance.ObjectProvenance; import com.oracle.labs.mlrg.olcut.provenance.Provenance; import com.oracle.labs.mlrg.olcut.provenance.primitives.DoubleProvenance; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.MeanStdDevTransformerProto; +import org.tribuo.protos.core.TransformerProto; import org.tribuo.transform.TransformStatistics; import org.tribuo.transform.Transformation; import org.tribuo.transform.TransformationProvenance; @@ -201,21 +208,56 @@ public String toString() { } } - private static class MeanStdDevTransformer implements Transformer { + @ProtoSerializableClass(version = MeanStdDevTransformer.CURRENT_VERSION, serializedDataClass = MeanStdDevTransformerProto.class) + static final class MeanStdDevTransformer implements Transformer { private static final long serialVersionUID = 1L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + + @ProtoSerializableField private final double observedMean; + @ProtoSerializableField private final double observedStdDev; + @ProtoSerializableField private final double targetMean; + @ProtoSerializableField private final double targetStdDev; - public MeanStdDevTransformer(double observedMean, double observedStdDev, double targetMean, double targetStdDev) { + MeanStdDevTransformer(double observedMean, double observedStdDev, double targetMean, double targetStdDev) { + if ((observedStdDev < 0) || (targetStdDev < 0)) { + throw new IllegalArgumentException("Standard deviations must be non-negative."); + } this.observedMean = observedMean; this.observedStdDev = observedStdDev; this.targetMean = targetMean; this.targetStdDev = targetStdDev; } + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + * @throws InvalidProtocolBufferException If the message is not a {@link MeanStdDevTransformerProto}. + */ + static MeanStdDevTransformer deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + MeanStdDevTransformerProto proto = message.unpack(MeanStdDevTransformerProto.class); + if (version == CURRENT_VERSION) { + return new MeanStdDevTransformer(proto.getObservedMean(),proto.getObservedStdDev(), + proto.getTargetMean(),proto.getTargetStdDev()); + } else { + throw new IllegalArgumentException("Unknown version " + version + " expected {0}"); + } + } + + @Override + public TransformerProto serialize() { + return ProtoUtil.serialize(this); + } + @Override public double transform(double input) { return (((input - observedMean) / observedStdDev) * targetStdDev) + targetMean; @@ -225,6 +267,19 @@ public double transform(double input) { public String toString() { return "MeanStdDevTransformer(observedMean="+observedMean+",observedStdDev="+observedStdDev+",targetMean="+targetMean+",targetStdDev="+targetStdDev+")"; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + MeanStdDevTransformer that = (MeanStdDevTransformer) o; + return Double.compare(that.observedMean, observedMean) == 0 && Double.compare(that.observedStdDev, observedStdDev) == 0 && Double.compare(that.targetMean, targetMean) == 0 && Double.compare(that.targetStdDev, targetStdDev) == 0; + } + + @Override + public int hashCode() { + return Objects.hash(observedMean, observedStdDev, targetMean, targetStdDev); + } } } diff --git a/Core/src/main/java/org/tribuo/transform/transformations/SimpleTransform.java b/Core/src/main/java/org/tribuo/transform/transformations/SimpleTransform.java index 3133220b5..77e9f6405 100644 --- a/Core/src/main/java/org/tribuo/transform/transformations/SimpleTransform.java +++ b/Core/src/main/java/org/tribuo/transform/transformations/SimpleTransform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,18 @@ package org.tribuo.transform.transformations; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; import com.oracle.labs.mlrg.olcut.config.Config; import com.oracle.labs.mlrg.olcut.provenance.ObjectProvenance; import com.oracle.labs.mlrg.olcut.provenance.Provenance; import com.oracle.labs.mlrg.olcut.provenance.primitives.DoubleProvenance; import com.oracle.labs.mlrg.olcut.provenance.primitives.EnumProvenance; +import org.tribuo.protos.ProtoSerializableClass; +import org.tribuo.protos.ProtoSerializableField; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.SimpleTransformProto; +import org.tribuo.protos.core.TransformerProto; import org.tribuo.transform.TransformStatistics; import org.tribuo.transform.Transformation; import org.tribuo.transform.TransformationProvenance; @@ -43,9 +50,15 @@ * Wraps a {@link DoubleUnaryOperator} which actually performs the * transformation. */ +@ProtoSerializableClass(version = SimpleTransform.CURRENT_VERSION, serializedDataClass = SimpleTransformProto.class) public final class SimpleTransform implements Transformer, Transformation, TransformStatistics { private static final long serialVersionUID = 1L; + /** + * Protobuf serialization version. + */ + public static final int CURRENT_VERSION = 0; + private static final String OP = "op"; private static final String OPERAND = "operand"; private static final String SECOND_OPERAND = "secondOperand"; @@ -93,12 +106,15 @@ public enum Operation { threshold } + @ProtoSerializableField @Config(mandatory = true,description="Type of the simple transformation.") private Operation op; + @ProtoSerializableField(name="firstOperand") @Config(description="Operand (if required).") private double operand = Double.NaN; + @ProtoSerializableField @Config(description="Second operand (if required).") private double secondOperand = Double.NaN; @@ -111,7 +127,7 @@ public enum Operation { */ private SimpleTransform() {} - private SimpleTransform(Operation op, double operand, double secondOperand) { + SimpleTransform(Operation op, double operand, double secondOperand) { this.op = op; this.operand = operand; this.secondOperand = secondOperand; @@ -181,6 +197,22 @@ public void postConfig() { } } + /** + * Deserialization factory. + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + * @throws InvalidProtocolBufferException If the message is not a {@link SimpleTransformProto}. + */ + static SimpleTransform deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + SimpleTransformProto proto = message.unpack(SimpleTransformProto.class); + if (version == CURRENT_VERSION) { + return new SimpleTransform(Operation.valueOf(proto.getOp()), proto.getFirstOperand(), proto.getSecondOperand()); + } else { + throw new IllegalArgumentException("Unknown version " + version + " expected {0}"); + } + } + @Override public TransformationProvenance getProvenance() { if (provenance == null) { @@ -189,6 +221,24 @@ public TransformationProvenance getProvenance() { return provenance; } + @Override + public TransformerProto serialize() { + return ProtoUtil.serialize(this); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SimpleTransform that = (SimpleTransform) o; + return Double.compare(that.operand, operand) == 0 && Double.compare(that.secondOperand, secondOperand) == 0 && op == that.op; + } + + @Override + public int hashCode() { + return Objects.hash(op, operand, secondOperand); + } + /** * Provenance for {@link SimpleTransform}. */ diff --git a/Core/src/main/resources/protos/tribuo-core-impl.proto b/Core/src/main/resources/protos/tribuo-core-impl.proto new file mode 100644 index 000000000..32e4b8975 --- /dev/null +++ b/Core/src/main/resources/protos/tribuo-core-impl.proto @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +syntax = "proto3"; + +/* + * Protos for serializing Tribuo core types and interfaces. + */ +package tribuo.core; + +option java_multiple_files = true; +option java_package = "org.tribuo.protos.core"; + +// Import Tribuo's core protos +import "tribuo-core.proto"; + +// Import OLCUT's provenance proto +import "olcut_proto.proto"; + +/* +HashedFeatureMap proto + */ +message HashedFeatureMapProto { + HasherProto hasher = 1; + repeated VariableInfoProto info = 2; +} + +/* +ImmutableFeatureMap proto + */ +message ImmutableFeatureMapProto { + repeated VariableInfoProto info = 1; +} + +/* +MutableFeatureMap proto + */ +message MutableFeatureMapProto { + bool convert_high_cardinality = 1; + repeated VariableInfoProto info = 2; +} + +/* +RealInfo proto + */ +message RealInfoProto { + string name = 1; + int32 count = 2; + double max = 10; + double min = 11; + double mean = 12; + double sumSquares = 13; +} + +/* +RealIDInfo proto + */ +message RealIDInfoProto { + string name = 1; + int32 count = 2; + int32 id = 3; + double max = 10; + double min = 11; + double mean = 12; + double sumSquares = 13; +} + +/* +CategoricalInfo proto + */ +message CategoricalInfoProto { + string name = 1; + int32 count = 2; + repeated double key = 10; + repeated int64 value = 11; + double observed_value = 12; + int64 observed_count = 13; +} + +/* +CategoricalIDInfo proto + */ +message CategoricalIDInfoProto { + string name = 1; + int32 count = 2; + int32 id = 3; + repeated double key = 10; + repeated int64 value = 11; + double observed_value = 12; + int64 observed_count = 13; +} + +/* +MessageDigestHasher proto + */ +message MessageDigestHasherProto { + string hash_type = 1; +} + +/* +ModHashCodeHasher proto + */ +message ModHashCodeHasherProto { + int32 dimension = 1; +} + +/* +SimpleTransform proto + */ +message SimpleTransformProto { + string op = 1; + double first_operand = 2; + double second_operand = 3; +} + +/* +MeanStdDevTransformer proto + */ +message MeanStdDevTransformerProto { + double observedMean = 1; + double observedStdDev = 2; + double targetMean = 3; + double targetStdDev = 4; +} + +/* +LinearScalingTransformer proto + */ +message LinearScalingTransformerProto { + double observedMin = 1; + double observedMax = 2; + double targetMin = 3; + double targetMax = 4; +} + +/* +IDFTransformer proto + */ +message IDFTransformerProto { + double df = 1; + double N = 2; +} + +/* +BinningTransformer proto + */ +message BinningTransformerProto { + string binning_type = 1; + repeated double bins = 2; + repeated double values = 3; +} + +/* +CountTransformer proto (used in tests) + */ +message TestCountTransformerProto { + int32 count = 1; + int32 sparseCount = 2; + repeated double countMapKeys = 3; + repeated int64 countMapValues = 4; +} diff --git a/Core/src/main/resources/protos/tribuo-core.proto b/Core/src/main/resources/protos/tribuo-core.proto new file mode 100644 index 000000000..6e0dd5d39 --- /dev/null +++ b/Core/src/main/resources/protos/tribuo-core.proto @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +syntax = "proto3"; + +/* + * Protos for serializing Tribuo core types and interfaces. + */ +package tribuo.core; + +option java_multiple_files = true; +option java_package = "org.tribuo.protos.core"; + +// We use any to encode polymorphism in feature domains, output domains, and model values +import "google/protobuf/any.proto"; + +// Import OLCUT's provenance proto +import "olcut_proto.proto"; + +/* +Base model protobuf. Contains the core model fields, along with the ModelDataProto +containing model specific information. + */ +message ModelProto { + /* + Version number of the model proto + */ + int32 version = 1; + /* + The model name + */ + string name = 2; + /* + The model provenance + */ + olcut.RootProvenanceProto provenance = 3; + /* + Does the model generate probabilities + */ + bool generate_probabilities = 4; + /* + Model feature domain + */ + FeatureDomainProto feature_domain = 5; + /* + Model output domain + */ + OutputDomainProto output_domain = 6; + /* + Model data + */ + ModelDataProto model_data = 7; +} + +/* +Output Factory redirection proto + */ +message OutputFactoryProto { + int32 version = 1; + string class_name = 2; + google.protobuf.Any serialized_data = 3; +} + +/* +Feature domain redirection proto + */ +message FeatureDomainProto { + int32 version = 1; + string class_name = 2; + google.protobuf.Any serialized_data = 3; +} + +/* +Feature info redirection proto + */ +message VariableInfoProto { + int32 version = 1; + string class_name = 2; + google.protobuf.Any serialized_data = 3; +} + +/* +Output domain redirection proto + */ +message OutputDomainProto { + int32 version = 1; + string class_name = 2; + google.protobuf.Any serialized_data = 3; +} + +/* +Model data redirection proto + */ +message ModelDataProto { + int32 version = 1; + string class_name = 2; + google.protobuf.Any serialized_data = 3; +} + +/* +Output redirection proto + */ +message OutputProto { + int32 version = 1; + string class_name = 2; + google.protobuf.Any serialized_data = 3; +} + +/* +Example proto + */ +message ExampleProto { + int32 version = 1; + string class_name = 2; + OutputProto output = 3; + repeated string feature_name = 4; + repeated double feature_value = 5; + map metadata = 6; +} + +/* +Dataset proto + */ +message DatasetProto { + int32 version = 1; + string class_name = 2; + olcut.RootProvenanceProto provenance = 3; + FeatureDomainProto feature_domain = 4; + OutputDomainProto output_domain = 5; + repeated ExampleProto examples = 6; + olcut.ListProvenanceProto transform_provenance = 7; +} + +/* +Prediction proto + */ +message PredictionProto { + int32 version = 1; + string class_name = 2; + ExampleProto example = 3; + OutputProto output = 4; + bool probability = 5; + int32 num_used = 6; + int32 example_size = 7; + map output_scores = 8; +} + +/* +Combiner redirection proto + */ +message EnsembleCombinerProto { + int32 version = 1; + string class_name = 2; + google.protobuf.Any serialized_data = 3; +} + +/* +Transformer redirection proto + */ +message TransformerProto { + int32 version = 1; + string class_name = 2; + google.protobuf.Any serialized_data = 3; +} + +/* +Transformer list proto + */ +message TransformerListProto { + repeated TransformerProto transformer = 1; +} + +/* +Transformer map proto + */ +message TransformerMapProto { + int32 version = 1; + map transformers = 2; + olcut.RootProvenanceProto datasetProvenance = 3; + olcut.RootProvenanceProto transformationMapProvenance = 4; +} + +/* +Hasher redirection proto + */ +message HasherProto { + int32 version = 1; + string class_name = 2; + google.protobuf.Any serialized_data = 3; +} + +/* +Mean variance accumulator proto + */ +message MeanVarianceProto { + int32 version = 1; + double max = 2; + double min = 3; + double mean = 4; + double sumSquares = 5; + int64 count = 6; +} diff --git a/Core/src/test/java/org/tribuo/CategoricalInfoTest.java b/Core/src/test/java/org/tribuo/CategoricalInfoTest.java index cea02e910..a0fdb5322 100644 --- a/Core/src/test/java/org/tribuo/CategoricalInfoTest.java +++ b/Core/src/test/java/org/tribuo/CategoricalInfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,19 @@ package org.tribuo; import org.junit.jupiter.api.Test; - +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.CategoricalIDInfoProto; +import org.tribuo.protos.core.CategoricalInfoProto; +import org.tribuo.protos.core.VariableInfoProto; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.SplittableRandom; +import java.util.stream.IntStream; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.fail; /** @@ -63,6 +72,18 @@ public static CategoricalInfo generateOneValueInfo() { return newInfo; } + public static CategoricalInfo generateProtoTestInfo() { + CategoricalInfo ci = new CategoricalInfo("cat"); + + IntStream.range(0, 10).forEach(i -> { + IntStream.range(0, i*2).forEach(j -> { + ci.observe(i); + }); + }); + + return ci; + } + public void checkValueAndProb(CategoricalInfo c, double value, double probability) { int idx = -1; for (int i = 0; i < c.values.length; i++) { @@ -156,4 +177,124 @@ public void samplingTest() { checkValueAndProb(c,4.0,0.05); } + @Test + public void equalityTest() { + CategoricalInfo fullFirst = generateFullInfo(); + CategoricalInfo fullSecond = generateFullInfo(); + CategoricalInfo emptyFirst = generateEmptyInfo(); + CategoricalInfo emptySecond = generateEmptyInfo(); + CategoricalInfo oneFirst = generateOneValueInfo(); + CategoricalInfo oneSecond = generateOneValueInfo(); + + assertEquals(fullFirst,fullSecond); + assertEquals(emptyFirst,emptySecond); + assertEquals(oneFirst,oneSecond); + + assertNotEquals(fullFirst,emptyFirst); + assertNotEquals(fullFirst,oneFirst); + } + + @Test + void testCategoricalInfo() throws Exception { + CategoricalInfo info = new CategoricalInfo("cat"); + IntStream.range(0, 10).forEach(i -> { + IntStream.range(0, i*2).forEach(j -> { + info.observe(i); + }); + }); + + VariableInfoProto infoProto = info.serialize(); + assertEquals(0, infoProto.getVersion()); + assertEquals("org.tribuo.CategoricalInfo", infoProto.getClassName()); + CategoricalInfoProto proto = infoProto.getSerializedData().unpack(CategoricalInfoProto.class); + assertEquals("cat", proto.getName()); + assertEquals(90, proto.getCount()); + assertEquals(0, proto.getObservedCount()); + assertEquals(Double.NaN, proto.getObservedValue()); + + List keyList = proto.getKeyList(); + List valueList = proto.getValueList(); + + assertEquals(9, keyList.size()); + assertEquals(9, valueList.size()); + + Map expectedCounts = new HashMap<>(); + IntStream.range(0, 10).forEach(i -> { + long count = info.getObservationCount(i); + expectedCounts.put((double)i, count); + }); + + for (int i=0; i { + info.observe(5); + }); + + VariableInfoProto infoProto = info.serialize(); + assertEquals(0, infoProto.getVersion()); + assertEquals("org.tribuo.CategoricalInfo", infoProto.getClassName()); + CategoricalInfoProto proto = infoProto.getSerializedData().unpack(CategoricalInfoProto.class); + assertEquals("cat", proto.getName()); + assertEquals(10, proto.getCount()); + + List keyList = proto.getKeyList(); + List valueList = proto.getValueList(); + + assertEquals(0, keyList.size()); + assertEquals(0, valueList.size()); + assertEquals(5, proto.getObservedValue()); + assertEquals(10, proto.getObservedCount()); + + VariableInfo infoD = ProtoUtil.deserialize(infoProto); + assertEquals(info, infoD); + } + + @Test + void testCategoricalIdInfo() throws Exception { + CategoricalInfo info = new CategoricalInfo("cat"); + IntStream.range(0, 10).forEach(i -> { + IntStream.range(0, i*2).forEach(j -> { + info.observe(i); + }); + }); + + CategoricalIDInfo idInfo = info.makeIDInfo(12345); + + VariableInfoProto infoProto = idInfo.serialize(); + assertEquals(0, infoProto.getVersion()); + assertEquals("org.tribuo.CategoricalIDInfo", infoProto.getClassName()); + CategoricalIDInfoProto proto = infoProto.getSerializedData().unpack(CategoricalIDInfoProto.class); + assertEquals("cat", proto.getName()); + assertEquals(90, proto.getCount()); + assertEquals(12345, proto.getId()); + assertEquals(0, proto.getObservedCount()); + assertEquals(Double.NaN, proto.getObservedValue()); + + List keyList = proto.getKeyList(); + List valueList = proto.getValueList(); + + assertEquals(keyList.size(), valueList.size()); + + Map expectedCounts = new HashMap<>(); + IntStream.range(0, 10).forEach(i -> { + long count = idInfo.getObservationCount(i); + expectedCounts.put((double)i, count); + }); + + for (int i=0; i ProtoUtil.getSerializedClass(new PSB2())); + } + + public static interface IPS extends ProtoSerializable{ } + + public static class PSA implements IPS{ + + @Override + public B serialize() { + return ProtoUtil.serialize(this); + } + + } + + public static class PSB extends PSA{ } + + public static class PSC extends PSB{ } + + public static interface IPS2 extends ProtoSerializable{ } + + //Tricky! we purposefully mixed up the type variable names + public static class PSA2 implements IPS2{ + + @Override + public B serialize() { + return ProtoUtil.serialize(this); + } + + } + + public static class PSB2 extends PSA2{ } + + public static class PSC2 extends PSB{ } + + public static class PSD2 extends PSC2{ } + +} \ No newline at end of file diff --git a/Core/src/test/java/org/tribuo/transform/TransformationMapTest.java b/Core/src/test/java/org/tribuo/transform/TransformationMapTest.java index b3640f790..054c074bb 100644 --- a/Core/src/test/java/org/tribuo/transform/TransformationMapTest.java +++ b/Core/src/test/java/org/tribuo/transform/TransformationMapTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,15 @@ package org.tribuo.transform; +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; import com.oracle.labs.mlrg.olcut.provenance.Provenance; import com.oracle.labs.mlrg.olcut.util.MutableLong; import org.tribuo.MutableDataset; import org.tribuo.impl.ArrayExample; +import org.tribuo.protos.core.TestCountTransformerProto; +import org.tribuo.protos.core.TransformerMapProto; +import org.tribuo.protos.core.TransformerProto; import org.tribuo.test.MockDataSourceProvenance; import org.tribuo.test.MockOutput; import org.tribuo.test.MockOutputFactory; @@ -33,8 +38,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.fail; /** @@ -43,80 +50,80 @@ public class TransformationMapTest { public static MutableDataset generateDenseDataset() { - MutableDataset dataset = new MutableDataset<>(new MockDataSourceProvenance(),new MockOutputFactory()); + MutableDataset dataset = new MutableDataset<>(new MockDataSourceProvenance(), new MockOutputFactory()); MockOutput output = new MockOutput("UNK"); - String[] featureNames = new String[]{"F0","F1","F2","F3","F4"}; + String[] featureNames = new String[]{"F0", "F1", "F2", "F3", "F4"}; ArrayExample example; - example = new ArrayExample<>(output,featureNames,new double[]{1,1,1,1,1}); + example = new ArrayExample<>(output, featureNames, new double[]{1, 1, 1, 1, 1}); dataset.add(example); - example = new ArrayExample<>(output,featureNames,new double[]{1,2,3,4,5}); + example = new ArrayExample<>(output, featureNames, new double[]{1, 2, 3, 4, 5}); dataset.add(example); - example = new ArrayExample<>(output,featureNames,new double[]{0.5,0.5,0.5,0.5,0.5}); + example = new ArrayExample<>(output, featureNames, new double[]{0.5, 0.5, 0.5, 0.5, 0.5}); dataset.add(example); - example = new ArrayExample<>(output,featureNames,new double[]{0,0,0,0,0}); + example = new ArrayExample<>(output, featureNames, new double[]{0, 0, 0, 0, 0}); dataset.add(example); - example = new ArrayExample<>(output,featureNames,new double[]{10,9,8,7,6}); + example = new ArrayExample<>(output, featureNames, new double[]{10, 9, 8, 7, 6}); dataset.add(example); - example = new ArrayExample<>(output,featureNames,new double[]{2,2,2,2,2}); + example = new ArrayExample<>(output, featureNames, new double[]{2, 2, 2, 2, 2}); dataset.add(example); - example = new ArrayExample<>(output,featureNames,new double[]{10,10,10,10,10}); + example = new ArrayExample<>(output, featureNames, new double[]{10, 10, 10, 10, 10}); dataset.add(example); - example = new ArrayExample<>(output,featureNames,new double[]{1,5,1,5,1}); + example = new ArrayExample<>(output, featureNames, new double[]{1, 5, 1, 5, 1}); dataset.add(example); - example = new ArrayExample<>(output,featureNames,new double[]{5,1,5,1,5}); + example = new ArrayExample<>(output, featureNames, new double[]{5, 1, 5, 1, 5}); dataset.add(example); - example = new ArrayExample<>(output,featureNames,new double[]{1,2,3,4,5}); + example = new ArrayExample<>(output, featureNames, new double[]{1, 2, 3, 4, 5}); dataset.add(example); return dataset; } public static MutableDataset generateSparseDataset() { - MutableDataset dataset = new MutableDataset<>(new MockDataSourceProvenance(),new MockOutputFactory()); + MutableDataset dataset = new MutableDataset<>(new MockDataSourceProvenance(), new MockOutputFactory()); MockOutput output = new MockOutput("UNK"); - String[] featureNames = new String[]{"F0","F1","F2","F3","F4"}; + String[] featureNames = new String[]{"F0", "F1", "F2", "F3", "F4"}; ArrayExample example; - example = new ArrayExample<>(output,featureNames,new double[]{1,1,1,1,1}); + example = new ArrayExample<>(output, featureNames, new double[]{1, 1, 1, 1, 1}); dataset.add(example); - example = new ArrayExample<>(output,new String[]{"F0","F1","F2","F3"},new double[]{1,2,3,4}); + example = new ArrayExample<>(output, new String[]{"F0", "F1", "F2", "F3"}, new double[]{1, 2, 3, 4}); dataset.add(example); - example = new ArrayExample<>(output,new String[]{"F0"},new double[]{10}); + example = new ArrayExample<>(output, new String[]{"F0"}, new double[]{10}); dataset.add(example); - example = new ArrayExample<>(output,new String[]{"F0","F2"},new double[]{1,1}); + example = new ArrayExample<>(output, new String[]{"F0", "F2"}, new double[]{1, 1}); dataset.add(example); - example = new ArrayExample<>(output,new String[]{"F1"},new double[]{1}); + example = new ArrayExample<>(output, new String[]{"F1"}, new double[]{1}); dataset.add(example); - example = new ArrayExample<>(output,new String[]{"F2"},new double[]{5}); + example = new ArrayExample<>(output, new String[]{"F2"}, new double[]{5}); dataset.add(example); - example = new ArrayExample<>(output,new String[]{"F1","F3"},new double[]{2,2}); + example = new ArrayExample<>(output, new String[]{"F1", "F3"}, new double[]{2, 2}); dataset.add(example); - example = new ArrayExample<>(output,new String[]{"F3"},new double[]{2}); + example = new ArrayExample<>(output, new String[]{"F3"}, new double[]{2}); dataset.add(example); - example = new ArrayExample<>(output,new String[]{"F3"},new double[]{4}); + example = new ArrayExample<>(output, new String[]{"F3"}, new double[]{4}); dataset.add(example); - example = new ArrayExample<>(output,new String[]{"F1","F2","F4"},new double[]{1,1,1}); + example = new ArrayExample<>(output, new String[]{"F1", "F2", "F4"}, new double[]{1, 1, 1}); dataset.add(example); return dataset; @@ -126,12 +133,12 @@ public static MutableDataset generateSparseDataset() { public void testRegex() { MutableDataset dataset = generateDenseDataset(); - HashMap> map = new HashMap<>(); + HashMap> map = new HashMap<>(); map.put("F0", Collections.singletonList(SimpleTransform.add(0))); map.put("F\\d", Collections.singletonList(SimpleTransform.add(0))); - TransformationMap t = new TransformationMap(new ArrayList<>(),map); + TransformationMap t = new TransformationMap(new ArrayList<>(), map); try { TransformerMap tMap = dataset.createTransformers(t); @@ -147,76 +154,86 @@ public void testRegex() { public void testNumTransformers() { MutableDataset dataset = generateDenseDataset(); - HashMap> map = new HashMap<>(); + HashMap> map = new HashMap<>(); map.put("F0", Collections.singletonList(SimpleTransform.add(1))); - map.put("F[34]",Arrays.asList(SimpleTransform.add(5),SimpleTransform.log())); - map.put("F1",Arrays.asList(SimpleTransform.add(1),SimpleTransform.mul(5),SimpleTransform.exp())); + map.put("F[34]", Arrays.asList(SimpleTransform.add(5), SimpleTransform.log())); + map.put("F1", Arrays.asList(SimpleTransform.add(1), SimpleTransform.mul(5), SimpleTransform.exp())); - TransformationMap t = new TransformationMap(Collections.singletonList(new LinearScalingTransformation()),map); + TransformationMap t = new TransformationMap(Collections.singletonList(new LinearScalingTransformation()), map); TransformerMap tMap = dataset.createTransformers(t); - for (Map.Entry> e : tMap.entrySet()) { + for (Map.Entry> e : tMap.entrySet()) { switch (e.getKey()) { case "F0": - assertEquals(2,e.getValue().size()); + assertEquals(2, e.getValue().size()); break; case "F1": - assertEquals(4,e.getValue().size()); + assertEquals(4, e.getValue().size()); break; case "F2": - assertEquals(1,e.getValue().size()); + assertEquals(1, e.getValue().size()); break; case "F3": - assertEquals(3,e.getValue().size()); + assertEquals(3, e.getValue().size()); break; case "F4": - assertEquals(3,e.getValue().size()); + assertEquals(3, e.getValue().size()); break; default: fail("Unknown feature named " + e.getKey()); } } + + TransformerMapProto proto = tMap.serialize(); + TransformerMap deserialized = TransformerMap.deserialize(proto); + assertEquals(tMap, deserialized); + assertNotSame(tMap, deserialized); } @Test public void testSparseObservations() { MutableDataset dataset = generateSparseDataset(); - TransformationMap t = new TransformationMap(Collections.singletonList(new CountTransformation()),new HashMap<>()); + TransformationMap t = new TransformationMap(Collections.singletonList(new CountTransformation()), new HashMap<>()); - TransformerMap tMap = dataset.createTransformers(t,true); + TransformerMap tMap = dataset.createTransformers(t, true); - for (Map.Entry> e : tMap.entrySet()) { + for (Map.Entry> e : tMap.entrySet()) { CountTransformer countTransformer = (CountTransformer) e.getValue().get(0); switch (e.getKey()) { case "F0": - assertEquals(6,countTransformer.sparseCount); - assertEquals(4,countTransformer.count); + assertEquals(6, countTransformer.sparseCount); + assertEquals(4, countTransformer.count); break; case "F1": - assertEquals(5,countTransformer.sparseCount); - assertEquals(5,countTransformer.count); + assertEquals(5, countTransformer.sparseCount); + assertEquals(5, countTransformer.count); break; case "F2": - assertEquals(5,countTransformer.sparseCount); - assertEquals(5,countTransformer.count); + assertEquals(5, countTransformer.sparseCount); + assertEquals(5, countTransformer.count); break; case "F3": - assertEquals(5,countTransformer.sparseCount); - assertEquals(5,countTransformer.count); + assertEquals(5, countTransformer.sparseCount); + assertEquals(5, countTransformer.count); break; case "F4": - assertEquals(8,countTransformer.sparseCount); - assertEquals(2,countTransformer.count); + assertEquals(8, countTransformer.sparseCount); + assertEquals(2, countTransformer.count); break; default: fail("Unknown feature named " + e.getKey()); } } + + TransformerMapProto proto = tMap.serialize(); + TransformerMap deserialized = TransformerMap.deserialize(proto); + assertEquals(tMap, deserialized); + assertNotSame(tMap, deserialized); } - private static class CountTransformation implements Transformation { + public static class CountTransformation implements Transformation { @Override public TransformStatistics createStats() { return new CountStatistics(); @@ -224,17 +241,28 @@ public TransformStatistics createStats() { @Override public TransformationProvenance getProvenance() { - return new TransformationProvenance() { - @Override - public String getClassName() { - return CountTransformation.class.getName(); - } + return new CountTransformationProvenance(); + } + } - @Override - public Map getConfiguredParameters() { - return Collections.emptyMap(); - } - }; + public static class CountTransformationProvenance implements TransformationProvenance { + public CountTransformationProvenance() {} + + public CountTransformationProvenance(Map map) {} + + @Override + public String getClassName() { + return CountTransformation.class.getName(); + } + + @Override + public Map getConfiguredParameters() { + return Collections.emptyMap(); + } + + @Override + public boolean equals(Object o) { + return o instanceof CountTransformationProvenance; } } @@ -242,13 +270,13 @@ private static class CountStatistics implements TransformStatistics { public int sparseCount; - public Map countMap = new HashMap<>(); + public Map countMap = new HashMap<>(); public int count; @Override public void observeValue(double value) { - MutableLong l = countMap.computeIfAbsent(value,(k) -> new MutableLong()); + MutableLong l = countMap.computeIfAbsent(value, (k) -> new MutableLong()); l.increment(); count++; } @@ -266,24 +294,94 @@ public void observeSparse(int count) { @Override public Transformer generateTransformer() { - return new CountTransformer(sparseCount,count,countMap); + return new CountTransformer(sparseCount, count, countMap); } } private static class CountTransformer implements Transformer { public final int count; public final int sparseCount; - public final Map countMap; + public final Map countMap; - public CountTransformer(int sparseCount, int count, Map countMap) { + public CountTransformer(int sparseCount, int count, Map countMap) { this.count = count; this.sparseCount = sparseCount; this.countMap = countMap; } + /** + * Deserialization factory. + * + * @param version The serialized object version. + * @param className The class name. + * @param message The serialized data. + * @throws InvalidProtocolBufferException If the message is not a {@link TestCountTransformerProto}. + */ + static CountTransformer deserializeFromProto(int version, String className, Any message) throws InvalidProtocolBufferException { + TestCountTransformerProto proto = message.unpack(TestCountTransformerProto.class); + if (version == 0) { + Map countMap = new HashMap<>(); + for (int i = 0; i < proto.getCountMapKeysCount(); i++) { + countMap.put(proto.getCountMapKeys(i), new MutableLong(proto.getCountMapValues(i))); + } + return new CountTransformer(proto.getSparseCount(), proto.getCount(), + countMap); + } else { + throw new IllegalArgumentException("Unknown version " + version + " expected {0}"); + } + } + @Override public double transform(double input) { return input; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CountTransformer that = (CountTransformer) o; + // MutableLong in OLCUT 5.2.0 doesn't implement equals, + // so we can't compare countMap with Objects.equals. + // That'll be fixed in the next OLCUT but for the time being we've got this workaround. + if (countMap != null ^ that.countMap != null) { + return false; + } else if (countMap != null && that.countMap != null) { + if (countMap.size() != that.countMap.size()) { + return false; + } else { + for (Map.Entry e : countMap.entrySet()) { + MutableLong other = that.countMap.get(e.getKey()); + if ((other == null) || (e.getValue().longValue() != other.longValue())) { + return false; + } + } + } + } + return count == that.count && sparseCount == that.sparseCount; + } + + @Override + public int hashCode() { + return Objects.hash(count, sparseCount, countMap); + } + + @Override + public TransformerProto serialize() { + TransformerProto.Builder protoBuilder = TransformerProto.newBuilder(); + + protoBuilder.setVersion(0); + protoBuilder.setClassName(this.getClass().getName()); + + TestCountTransformerProto.Builder transformProto = TestCountTransformerProto.newBuilder() + .setCount(count).setSparseCount(sparseCount); + for (Map.Entry e : countMap.entrySet()) { + transformProto.addCountMapKeys(e.getKey()); + transformProto.addCountMapValues(e.getValue().longValue()); + } + protoBuilder.setSerializedData(Any.pack(transformProto.build())); + + return protoBuilder.build(); + } } } diff --git a/Core/src/test/java/org/tribuo/transform/BinningTest.java b/Core/src/test/java/org/tribuo/transform/transformations/BinningTest.java similarity index 88% rename from Core/src/test/java/org/tribuo/transform/BinningTest.java rename to Core/src/test/java/org/tribuo/transform/transformations/BinningTest.java index 90797a0e1..2010ece9f 100644 --- a/Core/src/test/java/org/tribuo/transform/BinningTest.java +++ b/Core/src/test/java/org/tribuo/transform/transformations/BinningTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,24 +14,32 @@ * limitations under the License. */ -package org.tribuo.transform; +package org.tribuo.transform.transformations; +import org.junit.jupiter.api.Test; import org.tribuo.CategoricalInfo; import org.tribuo.Dataset; import org.tribuo.FeatureMap; import org.tribuo.MutableDataset; import org.tribuo.impl.ArrayExample; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.TransformerProto; import org.tribuo.test.MockDataSourceProvenance; import org.tribuo.test.MockOutput; import org.tribuo.test.MockOutputFactory; -import org.tribuo.transform.transformations.BinningTransformation; -import org.junit.jupiter.api.Test; +import org.tribuo.transform.TransformationMap; +import org.tribuo.transform.Transformer; +import org.tribuo.transform.TransformerMap; +import org.tribuo.transform.transformations.BinningTransformation.BinningTransformer; +import org.tribuo.transform.transformations.BinningTransformation.BinningType; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Random; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; /** * @@ -92,6 +100,15 @@ public void testEqualWidthBinning() { assertEquals(2033,((CategoricalInfo)testFMap.get("F1")).getObservationCount(3)); assertEquals(1980,((CategoricalInfo)testFMap.get("F1")).getObservationCount(4)); assertEquals(2007,((CategoricalInfo)testFMap.get("F1")).getObservationCount(5)); + + List f0Transformer = tMap.get("F0"); + assertEquals(1,f0Transformer.size()); + + TransformerProto proto = f0Transformer.get(0).serialize(); + Transformer transformer = Transformer.deserialize(proto); + + assertEquals(f0Transformer.get(0), transformer); + assertNotSame(f0Transformer.get(0), transformer); } @Test @@ -176,4 +193,11 @@ public void testStdDevBinning() { assertEquals(0,((CategoricalInfo)testFMap.get("F1")).getObservationCount(6)); } + @Test + void testSerializeBinningTransformer() throws Exception { + BinningTransformer bt = new BinningTransformer(BinningType.EQUAL_FREQUENCY, new double[] {0.0, 0.1, 0.2}, new double[] {1.0, 10.0, 100.0}); + TransformerProto tp = bt.serialize(); + BinningTransformer btd = ProtoUtil.deserialize(tp); + assertEquals(bt, btd); + } } diff --git a/Core/src/test/java/org/tribuo/transform/transformations/IDFTransformTest.java b/Core/src/test/java/org/tribuo/transform/transformations/IDFTransformTest.java new file mode 100644 index 000000000..c52281ebe --- /dev/null +++ b/Core/src/test/java/org/tribuo/transform/transformations/IDFTransformTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.tribuo.transform.transformations; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.IDFTransformerProto; +import org.tribuo.protos.core.TransformerProto; +import org.tribuo.transform.Transformer; +import org.tribuo.transform.transformations.IDFTransformation.IDFTransformer; + +public class IDFTransformTest { + + @Test + void testSerialize() throws Exception { + IDFTransformer idft = new IDFTransformer(13, 17); + TransformerProto tp = idft.serialize(); + assertEquals(0, tp.getVersion()); + assertEquals("org.tribuo.transform.transformations.IDFTransformation$IDFTransformer", tp.getClassName()); + IDFTransformerProto proto = tp.getSerializedData().unpack(IDFTransformerProto.class); + assertEquals(13, proto.getDf()); + assertEquals(17, proto.getN()); + + Transformer tD = ProtoUtil.deserialize(tp); + assertEquals(idft, tD); + } + +} diff --git a/Core/src/test/java/org/tribuo/transform/LinearScalingTest.java b/Core/src/test/java/org/tribuo/transform/transformations/LinearScalingTest.java similarity index 77% rename from Core/src/test/java/org/tribuo/transform/LinearScalingTest.java rename to Core/src/test/java/org/tribuo/transform/transformations/LinearScalingTest.java index b457dcf13..5ed2848c8 100644 --- a/Core/src/test/java/org/tribuo/transform/LinearScalingTest.java +++ b/Core/src/test/java/org/tribuo/transform/transformations/LinearScalingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,19 +14,25 @@ * limitations under the License. */ -package org.tribuo.transform; +package org.tribuo.transform.transformations; +import org.junit.jupiter.api.Test; import org.tribuo.Dataset; import org.tribuo.Example; import org.tribuo.Feature; import org.tribuo.MutableDataset; import org.tribuo.impl.ArrayExample; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.LinearScalingTransformerProto; +import org.tribuo.protos.core.TransformerProto; import org.tribuo.test.MockDataSourceProvenance; import org.tribuo.test.MockOutput; import org.tribuo.test.MockOutputFactory; -import org.tribuo.transform.transformations.LinearScalingTransformation; -import org.tribuo.transform.transformations.SimpleTransform; -import org.junit.jupiter.api.Test; +import org.tribuo.transform.Transformation; +import org.tribuo.transform.TransformationMap; +import org.tribuo.transform.Transformer; +import org.tribuo.transform.TransformerMap; +import org.tribuo.transform.transformations.LinearScalingTransformation.LinearScalingTransformer; import java.util.Arrays; import java.util.Collections; @@ -36,6 +42,7 @@ import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -105,6 +112,15 @@ public void testGlobalLinearScaling(TransformationMap t, double min, double max) assertTrue(transFeature.getValue() < (max+1e-12)); } } + + List f0Transformer = map.get("F0"); + if (f0Transformer.size() == 1) { + TransformerProto proto = f0Transformer.get(0).serialize(); + Transformer transformer = Transformer.deserialize(proto); + + assertEquals(f0Transformer.get(0), transformer); + assertNotSame(f0Transformer.get(0), transformer); + } } @Test @@ -154,4 +170,20 @@ public void testGlobalLinearScalingFeatureSpecific() { testGlobalLinearScaling(t,0,1); } + @Test + void testSerialize() throws Exception { + LinearScalingTransformer lst = new LinearScalingTransformer(Math.E, Math.PI, 0.618033988749, 1.059463094359); + TransformerProto tp = lst.serialize(); + assertEquals(0, tp.getVersion()); + assertEquals("org.tribuo.transform.transformations.LinearScalingTransformation$LinearScalingTransformer", tp.getClassName()); + LinearScalingTransformerProto proto = tp.getSerializedData().unpack(LinearScalingTransformerProto.class); + assertEquals(Math.E, proto.getObservedMin()); + assertEquals(Math.PI, proto.getObservedMax()); + assertEquals(0.618033988749, proto.getTargetMin()); + assertEquals(1.059463094359, proto.getTargetMax()); + + Transformer tD = ProtoUtil.deserialize(tp); + assertEquals(lst, tD); + } + } diff --git a/Core/src/test/java/org/tribuo/transform/MeanStdDevTest.java b/Core/src/test/java/org/tribuo/transform/transformations/MeanStdDevTest.java similarity index 73% rename from Core/src/test/java/org/tribuo/transform/MeanStdDevTest.java rename to Core/src/test/java/org/tribuo/transform/transformations/MeanStdDevTest.java index 92fc7e093..af7a41794 100644 --- a/Core/src/test/java/org/tribuo/transform/MeanStdDevTest.java +++ b/Core/src/test/java/org/tribuo/transform/transformations/MeanStdDevTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,24 +14,33 @@ * limitations under the License. */ -package org.tribuo.transform; +package org.tribuo.transform.transformations; import org.tribuo.Dataset; import org.tribuo.FeatureMap; import org.tribuo.MutableDataset; import org.tribuo.RealInfo; import org.tribuo.impl.ArrayExample; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.MeanStdDevTransformerProto; +import org.tribuo.protos.core.TransformerProto; import org.tribuo.test.MockDataSourceProvenance; import org.tribuo.test.MockOutput; import org.tribuo.test.MockOutputFactory; -import org.tribuo.transform.transformations.MeanStdDevTransformation; +import org.tribuo.transform.Transformation; +import org.tribuo.transform.TransformationMap; +import org.tribuo.transform.Transformer; +import org.tribuo.transform.TransformerMap; +import org.tribuo.transform.transformations.MeanStdDevTransformation.MeanStdDevTransformer; import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Random; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.fail; /** @@ -123,6 +132,31 @@ public void testMeanStdDev(TransformationMap t, double targetMean, double target assertEquals(targetMean,((RealInfo)testFMap.get("F1")).getMean(),1e-2); assertEquals(targetStdDev,Math.sqrt(((RealInfo)testFMap.get("F1")).getVariance()),1e-2); + + List f0Transformer = tMap.get("F0"); + assertEquals(1,f0Transformer.size()); + + TransformerProto proto = f0Transformer.get(0).serialize(); + Transformer transformer = Transformer.deserialize(proto); + + assertEquals(f0Transformer.get(0), transformer); + assertNotSame(f0Transformer.get(0), transformer); } + + @Test + void testSerializeMeanStdDevTransformer() throws Exception { + Transformer t = new MeanStdDevTransformer(Math.E, Math.PI, 0.618033988749, 1.059463094359); + TransformerProto tp = t.serialize(); + assertEquals(0, tp.getVersion()); + assertEquals("org.tribuo.transform.transformations.MeanStdDevTransformation$MeanStdDevTransformer", tp.getClassName()); + MeanStdDevTransformerProto proto = tp.getSerializedData().unpack(MeanStdDevTransformerProto.class); + assertEquals(Math.E, proto.getObservedMean()); + assertEquals(Math.PI, proto.getObservedStdDev()); + assertEquals(0.618033988749, proto.getTargetMean()); + assertEquals(1.059463094359, proto.getTargetStdDev()); + + Transformer tD = ProtoUtil.deserialize(tp); + assertEquals(t, tD); + } } diff --git a/Core/src/test/java/org/tribuo/transform/SimpleTransformTest.java b/Core/src/test/java/org/tribuo/transform/transformations/SimpleTransformTest.java similarity index 89% rename from Core/src/test/java/org/tribuo/transform/SimpleTransformTest.java rename to Core/src/test/java/org/tribuo/transform/transformations/SimpleTransformTest.java index c8151b3a6..552f673bd 100644 --- a/Core/src/test/java/org/tribuo/transform/SimpleTransformTest.java +++ b/Core/src/test/java/org/tribuo/transform/transformations/SimpleTransformTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015-2022, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,18 +14,25 @@ * limitations under the License. */ -package org.tribuo.transform; +package org.tribuo.transform.transformations; +import org.junit.jupiter.api.Test; import org.tribuo.Dataset; import org.tribuo.Example; import org.tribuo.Feature; import org.tribuo.MutableDataset; import org.tribuo.impl.ArrayExample; +import org.tribuo.protos.ProtoUtil; +import org.tribuo.protos.core.SimpleTransformProto; +import org.tribuo.protos.core.TransformerProto; import org.tribuo.test.MockDataSourceProvenance; import org.tribuo.test.MockOutput; import org.tribuo.test.MockOutputFactory; -import org.tribuo.transform.transformations.SimpleTransform; -import org.junit.jupiter.api.Test; +import org.tribuo.transform.Transformation; +import org.tribuo.transform.TransformationMap; +import org.tribuo.transform.Transformer; +import org.tribuo.transform.TransformerMap; +import org.tribuo.transform.transformations.SimpleTransform.Operation; import java.util.ArrayList; import java.util.Arrays; @@ -36,8 +43,9 @@ import java.util.Map; import java.util.function.DoubleUnaryOperator; -import static org.tribuo.transform.transformations.SimpleTransform.EPSILON; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.tribuo.transform.transformations.SimpleTransform.EPSILON; /** * @@ -165,6 +173,15 @@ public void testSimple(TransformationMap t, DoubleUnaryOperator op) { assertEquals(op.applyAsDouble(origFeature.getValue()),transFeature.getValue(), 1e-12); } } + + List f0Transformer = map.get("F0"); + if (f0Transformer.size() == 1) { + TransformerProto proto = f0Transformer.get(0).serialize(); + Transformer transformer = Transformer.deserialize(proto); + + assertEquals(f0Transformer.get(0), transformer); + assertNotSame(f0Transformer.get(0), transformer); + } } @Test @@ -317,4 +334,19 @@ public void testSpecificAndGlobal() { } } + @Test + void testSerializeSimpleTransform() throws Exception { + Transformer t = new SimpleTransform(Operation.exp, Math.E, Math.PI); + TransformerProto tp = t.serialize(); + assertEquals(0, tp.getVersion()); + assertEquals("org.tribuo.transform.transformations.SimpleTransform", tp.getClassName()); + SimpleTransformProto proto = tp.getSerializedData().unpack(SimpleTransformProto.class); + assertEquals("exp", proto.getOp()); + assertEquals(Math.E, proto.getFirstOperand()); + assertEquals(Math.PI, proto.getSecondOperand()); + + Transformer tD = ProtoUtil.deserialize(tp); + assertEquals(t, tD); + } + }