From 230dfe6d3fe428cd2192ed695b7cc72503a462ab Mon Sep 17 00:00:00 2001 From: Vladimir Eliezer Tokarev Date: Fri, 26 Feb 2016 05:17:29 -0800 Subject: [PATCH] Realocated the VoterRegistry.proto file and changed the usage of it --- .../main/proto/meerkat/VoterRegistry.proto | 23 + .../main/java/meerkat/RegistryMessages.java | 2470 ----------------- .../src/main/java/meerkat/SimpleRegistry.java | 12 +- .../src/main/java/meerkat/VoterRegistry.java | 12 +- .../src/test/java/SimpleRegistryTest.java | 26 +- 5 files changed, 48 insertions(+), 2495 deletions(-) create mode 100644 meerkat-common/src/main/proto/meerkat/VoterRegistry.proto delete mode 100644 voter-registry/src/main/java/meerkat/RegistryMessages.java diff --git a/meerkat-common/src/main/proto/meerkat/VoterRegistry.proto b/meerkat-common/src/main/proto/meerkat/VoterRegistry.proto new file mode 100644 index 0000000..e3f163f --- /dev/null +++ b/meerkat-common/src/main/proto/meerkat/VoterRegistry.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package meerkat; + +option java_package = "meerkat.protobuf"; + +message VoterID{ + string id = 1; +} + +message VoterInfo{ + VoterID id = 1; + string info = 2; +} + +message GroupID{ + string id = 1; +} + +message VoterGroup{ + VoterID voterId = 1; + GroupID groupId = 2; +} \ No newline at end of file diff --git a/voter-registry/src/main/java/meerkat/RegistryMessages.java b/voter-registry/src/main/java/meerkat/RegistryMessages.java deleted file mode 100644 index fe22dd8..0000000 --- a/voter-registry/src/main/java/meerkat/RegistryMessages.java +++ /dev/null @@ -1,2470 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: RegistryMessages.proto -package meerkat; - -public final class RegistryMessages { - private RegistryMessages() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - } - public interface VoterIDOrBuilder extends - // @@protoc_insertion_point(interface_extends:VoterID) - com.google.protobuf.MessageOrBuilder { - - /** - * required string id = 1; - */ - boolean hasId(); - /** - * required string id = 1; - */ - java.lang.String getId(); - /** - * required string id = 1; - */ - com.google.protobuf.ByteString - getIdBytes(); - } - /** - * Protobuf type {@code VoterID} - */ - public static final class VoterID extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:VoterID) - VoterIDOrBuilder { - // Use VoterID.newBuilder() to construct. - private VoterID(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private VoterID(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final VoterID defaultInstance; - public static VoterID getDefaultInstance() { - return defaultInstance; - } - - public VoterID getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private VoterID( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - id_ = bs; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return RegistryMessages.internal_static_VoterID_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return RegistryMessages.internal_static_VoterID_fieldAccessorTable - .ensureFieldAccessorsInitialized( - RegistryMessages.VoterID.class, RegistryMessages.VoterID.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public VoterID parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new VoterID(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int ID_FIELD_NUMBER = 1; - private java.lang.Object id_; - /** - * required string id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required string id = 1; - */ - public java.lang.String getId() { - java.lang.Object ref = id_; - 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(); - if (bs.isValidUtf8()) { - id_ = s; - } - return s; - } - } - /** - * required string id = 1; - */ - public com.google.protobuf.ByteString - getIdBytes() { - java.lang.Object ref = id_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - id_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - id_ = ""; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasId()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getIdBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getIdBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static RegistryMessages.VoterID parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static RegistryMessages.VoterID parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static RegistryMessages.VoterID parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static RegistryMessages.VoterID parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static RegistryMessages.VoterID parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static RegistryMessages.VoterID parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static RegistryMessages.VoterID parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static RegistryMessages.VoterID parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static RegistryMessages.VoterID parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static RegistryMessages.VoterID parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(RegistryMessages.VoterID prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code VoterID} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:VoterID) - RegistryMessages.VoterIDOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return RegistryMessages.internal_static_VoterID_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return RegistryMessages.internal_static_VoterID_fieldAccessorTable - .ensureFieldAccessorsInitialized( - RegistryMessages.VoterID.class, RegistryMessages.VoterID.Builder.class); - } - - // Construct using RegistryMessages.VoterID.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - id_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return RegistryMessages.internal_static_VoterID_descriptor; - } - - public RegistryMessages.VoterID getDefaultInstanceForType() { - return RegistryMessages.VoterID.getDefaultInstance(); - } - - public RegistryMessages.VoterID build() { - RegistryMessages.VoterID result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public RegistryMessages.VoterID buildPartial() { - RegistryMessages.VoterID result = new RegistryMessages.VoterID(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof RegistryMessages.VoterID) { - return mergeFrom((RegistryMessages.VoterID)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(RegistryMessages.VoterID other) { - if (other == RegistryMessages.VoterID.getDefaultInstance()) return this; - if (other.hasId()) { - bitField0_ |= 0x00000001; - id_ = other.id_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasId()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - RegistryMessages.VoterID parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (RegistryMessages.VoterID) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.lang.Object id_ = ""; - /** - * required string id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required string id = 1; - */ - public java.lang.String getId() { - java.lang.Object ref = id_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - id_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * required string id = 1; - */ - public com.google.protobuf.ByteString - getIdBytes() { - java.lang.Object ref = id_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - id_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * required string id = 1; - */ - public Builder setId( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - id_ = value; - onChanged(); - return this; - } - /** - * required string id = 1; - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000001); - id_ = getDefaultInstance().getId(); - onChanged(); - return this; - } - /** - * required string id = 1; - */ - public Builder setIdBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - id_ = value; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:VoterID) - } - - static { - defaultInstance = new VoterID(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:VoterID) - } - - public interface VoterInfoOrBuilder extends - // @@protoc_insertion_point(interface_extends:VoterInfo) - com.google.protobuf.MessageOrBuilder { - - /** - * required .VoterID id = 1; - */ - boolean hasId(); - /** - * required .VoterID id = 1; - */ - RegistryMessages.VoterID getId(); - /** - * required .VoterID id = 1; - */ - RegistryMessages.VoterIDOrBuilder getIdOrBuilder(); - - /** - * required string info = 2; - */ - boolean hasInfo(); - /** - * required string info = 2; - */ - java.lang.String getInfo(); - /** - * required string info = 2; - */ - com.google.protobuf.ByteString - getInfoBytes(); - } - /** - * Protobuf type {@code VoterInfo} - */ - public static final class VoterInfo extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:VoterInfo) - VoterInfoOrBuilder { - // Use VoterInfo.newBuilder() to construct. - private VoterInfo(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private VoterInfo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final VoterInfo defaultInstance; - public static VoterInfo getDefaultInstance() { - return defaultInstance; - } - - public VoterInfo getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private VoterInfo( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - RegistryMessages.VoterID.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - subBuilder = id_.toBuilder(); - } - id_ = input.readMessage(RegistryMessages.VoterID.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(id_); - id_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000001; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - info_ = bs; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return RegistryMessages.internal_static_VoterInfo_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return RegistryMessages.internal_static_VoterInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - RegistryMessages.VoterInfo.class, RegistryMessages.VoterInfo.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public VoterInfo parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new VoterInfo(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int ID_FIELD_NUMBER = 1; - private RegistryMessages.VoterID id_; - /** - * required .VoterID id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required .VoterID id = 1; - */ - public RegistryMessages.VoterID getId() { - return id_; - } - /** - * required .VoterID id = 1; - */ - public RegistryMessages.VoterIDOrBuilder getIdOrBuilder() { - return id_; - } - - public static final int INFO_FIELD_NUMBER = 2; - private java.lang.Object info_; - /** - * required string info = 2; - */ - public boolean hasInfo() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required string info = 2; - */ - public java.lang.String getInfo() { - java.lang.Object ref = info_; - 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(); - if (bs.isValidUtf8()) { - info_ = s; - } - return s; - } - } - /** - * required string info = 2; - */ - public com.google.protobuf.ByteString - getInfoBytes() { - java.lang.Object ref = info_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - info_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - id_ = RegistryMessages.VoterID.getDefaultInstance(); - info_ = ""; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasId()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasInfo()) { - memoizedIsInitialized = 0; - return false; - } - if (!getId().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getInfoBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getInfoBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static RegistryMessages.VoterInfo parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static RegistryMessages.VoterInfo parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static RegistryMessages.VoterInfo parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static RegistryMessages.VoterInfo parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static RegistryMessages.VoterInfo parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static RegistryMessages.VoterInfo parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static RegistryMessages.VoterInfo parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static RegistryMessages.VoterInfo parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static RegistryMessages.VoterInfo parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static RegistryMessages.VoterInfo parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(RegistryMessages.VoterInfo prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code VoterInfo} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:VoterInfo) - RegistryMessages.VoterInfoOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return RegistryMessages.internal_static_VoterInfo_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return RegistryMessages.internal_static_VoterInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - RegistryMessages.VoterInfo.class, RegistryMessages.VoterInfo.Builder.class); - } - - // Construct using RegistryMessages.VoterInfo.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getIdFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (idBuilder_ == null) { - id_ = RegistryMessages.VoterID.getDefaultInstance(); - } else { - idBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - info_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return RegistryMessages.internal_static_VoterInfo_descriptor; - } - - public RegistryMessages.VoterInfo getDefaultInstanceForType() { - return RegistryMessages.VoterInfo.getDefaultInstance(); - } - - public RegistryMessages.VoterInfo build() { - RegistryMessages.VoterInfo result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public RegistryMessages.VoterInfo buildPartial() { - RegistryMessages.VoterInfo result = new RegistryMessages.VoterInfo(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (idBuilder_ == null) { - result.id_ = id_; - } else { - result.id_ = idBuilder_.build(); - } - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.info_ = info_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof RegistryMessages.VoterInfo) { - return mergeFrom((RegistryMessages.VoterInfo)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(RegistryMessages.VoterInfo other) { - if (other == RegistryMessages.VoterInfo.getDefaultInstance()) return this; - if (other.hasId()) { - mergeId(other.getId()); - } - if (other.hasInfo()) { - bitField0_ |= 0x00000002; - info_ = other.info_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasId()) { - - return false; - } - if (!hasInfo()) { - - return false; - } - if (!getId().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - RegistryMessages.VoterInfo parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (RegistryMessages.VoterInfo) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private RegistryMessages.VoterID id_ = RegistryMessages.VoterID.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - RegistryMessages.VoterID, RegistryMessages.VoterID.Builder, RegistryMessages.VoterIDOrBuilder> idBuilder_; - /** - * required .VoterID id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required .VoterID id = 1; - */ - public RegistryMessages.VoterID getId() { - if (idBuilder_ == null) { - return id_; - } else { - return idBuilder_.getMessage(); - } - } - /** - * required .VoterID id = 1; - */ - public Builder setId(RegistryMessages.VoterID value) { - if (idBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - id_ = value; - onChanged(); - } else { - idBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - /** - * required .VoterID id = 1; - */ - public Builder setId( - RegistryMessages.VoterID.Builder builderForValue) { - if (idBuilder_ == null) { - id_ = builderForValue.build(); - onChanged(); - } else { - idBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - /** - * required .VoterID id = 1; - */ - public Builder mergeId(RegistryMessages.VoterID value) { - if (idBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - id_ != RegistryMessages.VoterID.getDefaultInstance()) { - id_ = - RegistryMessages.VoterID.newBuilder(id_).mergeFrom(value).buildPartial(); - } else { - id_ = value; - } - onChanged(); - } else { - idBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - /** - * required .VoterID id = 1; - */ - public Builder clearId() { - if (idBuilder_ == null) { - id_ = RegistryMessages.VoterID.getDefaultInstance(); - onChanged(); - } else { - idBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - /** - * required .VoterID id = 1; - */ - public RegistryMessages.VoterID.Builder getIdBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getIdFieldBuilder().getBuilder(); - } - /** - * required .VoterID id = 1; - */ - public RegistryMessages.VoterIDOrBuilder getIdOrBuilder() { - if (idBuilder_ != null) { - return idBuilder_.getMessageOrBuilder(); - } else { - return id_; - } - } - /** - * required .VoterID id = 1; - */ - private com.google.protobuf.SingleFieldBuilder< - RegistryMessages.VoterID, RegistryMessages.VoterID.Builder, RegistryMessages.VoterIDOrBuilder> - getIdFieldBuilder() { - if (idBuilder_ == null) { - idBuilder_ = new com.google.protobuf.SingleFieldBuilder< - RegistryMessages.VoterID, RegistryMessages.VoterID.Builder, RegistryMessages.VoterIDOrBuilder>( - getId(), - getParentForChildren(), - isClean()); - id_ = null; - } - return idBuilder_; - } - - private java.lang.Object info_ = ""; - /** - * required string info = 2; - */ - public boolean hasInfo() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required string info = 2; - */ - public java.lang.String getInfo() { - java.lang.Object ref = info_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - info_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * required string info = 2; - */ - public com.google.protobuf.ByteString - getInfoBytes() { - java.lang.Object ref = info_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - info_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * required string info = 2; - */ - public Builder setInfo( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - info_ = value; - onChanged(); - return this; - } - /** - * required string info = 2; - */ - public Builder clearInfo() { - bitField0_ = (bitField0_ & ~0x00000002); - info_ = getDefaultInstance().getInfo(); - onChanged(); - return this; - } - /** - * required string info = 2; - */ - public Builder setInfoBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - info_ = value; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:VoterInfo) - } - - static { - defaultInstance = new VoterInfo(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:VoterInfo) - } - - public interface GroupIDOrBuilder extends - // @@protoc_insertion_point(interface_extends:GroupID) - com.google.protobuf.MessageOrBuilder { - - /** - * required string id = 1; - */ - boolean hasId(); - /** - * required string id = 1; - */ - java.lang.String getId(); - /** - * required string id = 1; - */ - com.google.protobuf.ByteString - getIdBytes(); - } - /** - * Protobuf type {@code GroupID} - */ - public static final class GroupID extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:GroupID) - GroupIDOrBuilder { - // Use GroupID.newBuilder() to construct. - private GroupID(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private GroupID(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final GroupID defaultInstance; - public static GroupID getDefaultInstance() { - return defaultInstance; - } - - public GroupID getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private GroupID( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - id_ = bs; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return RegistryMessages.internal_static_GroupID_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return RegistryMessages.internal_static_GroupID_fieldAccessorTable - .ensureFieldAccessorsInitialized( - RegistryMessages.GroupID.class, RegistryMessages.GroupID.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public GroupID parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new GroupID(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int ID_FIELD_NUMBER = 1; - private java.lang.Object id_; - /** - * required string id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required string id = 1; - */ - public java.lang.String getId() { - java.lang.Object ref = id_; - 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(); - if (bs.isValidUtf8()) { - id_ = s; - } - return s; - } - } - /** - * required string id = 1; - */ - public com.google.protobuf.ByteString - getIdBytes() { - java.lang.Object ref = id_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - id_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - id_ = ""; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasId()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getIdBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getIdBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static RegistryMessages.GroupID parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static RegistryMessages.GroupID parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static RegistryMessages.GroupID parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static RegistryMessages.GroupID parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static RegistryMessages.GroupID parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static RegistryMessages.GroupID parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static RegistryMessages.GroupID parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static RegistryMessages.GroupID parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static RegistryMessages.GroupID parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static RegistryMessages.GroupID parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(RegistryMessages.GroupID prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code GroupID} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:GroupID) - RegistryMessages.GroupIDOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return RegistryMessages.internal_static_GroupID_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return RegistryMessages.internal_static_GroupID_fieldAccessorTable - .ensureFieldAccessorsInitialized( - RegistryMessages.GroupID.class, RegistryMessages.GroupID.Builder.class); - } - - // Construct using RegistryMessages.GroupID.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - id_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return RegistryMessages.internal_static_GroupID_descriptor; - } - - public RegistryMessages.GroupID getDefaultInstanceForType() { - return RegistryMessages.GroupID.getDefaultInstance(); - } - - public RegistryMessages.GroupID build() { - RegistryMessages.GroupID result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public RegistryMessages.GroupID buildPartial() { - RegistryMessages.GroupID result = new RegistryMessages.GroupID(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof RegistryMessages.GroupID) { - return mergeFrom((RegistryMessages.GroupID)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(RegistryMessages.GroupID other) { - if (other == RegistryMessages.GroupID.getDefaultInstance()) return this; - if (other.hasId()) { - bitField0_ |= 0x00000001; - id_ = other.id_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasId()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - RegistryMessages.GroupID parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (RegistryMessages.GroupID) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.lang.Object id_ = ""; - /** - * required string id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required string id = 1; - */ - public java.lang.String getId() { - java.lang.Object ref = id_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - id_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * required string id = 1; - */ - public com.google.protobuf.ByteString - getIdBytes() { - java.lang.Object ref = id_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - id_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * required string id = 1; - */ - public Builder setId( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - id_ = value; - onChanged(); - return this; - } - /** - * required string id = 1; - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000001); - id_ = getDefaultInstance().getId(); - onChanged(); - return this; - } - /** - * required string id = 1; - */ - public Builder setIdBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - id_ = value; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:GroupID) - } - - static { - defaultInstance = new GroupID(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:GroupID) - } - - public interface VoterGroupOrBuilder extends - // @@protoc_insertion_point(interface_extends:VoterGroup) - com.google.protobuf.MessageOrBuilder { - - /** - * required .VoterID voterId = 1; - */ - boolean hasVoterId(); - /** - * required .VoterID voterId = 1; - */ - RegistryMessages.VoterID getVoterId(); - /** - * required .VoterID voterId = 1; - */ - RegistryMessages.VoterIDOrBuilder getVoterIdOrBuilder(); - - /** - * required .GroupID groupId = 2; - */ - boolean hasGroupId(); - /** - * required .GroupID groupId = 2; - */ - RegistryMessages.GroupID getGroupId(); - /** - * required .GroupID groupId = 2; - */ - RegistryMessages.GroupIDOrBuilder getGroupIdOrBuilder(); - } - /** - * Protobuf type {@code VoterGroup} - */ - public static final class VoterGroup extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:VoterGroup) - VoterGroupOrBuilder { - // Use VoterGroup.newBuilder() to construct. - private VoterGroup(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private VoterGroup(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final VoterGroup defaultInstance; - public static VoterGroup getDefaultInstance() { - return defaultInstance; - } - - public VoterGroup getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private VoterGroup( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - RegistryMessages.VoterID.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - subBuilder = voterId_.toBuilder(); - } - voterId_ = input.readMessage(RegistryMessages.VoterID.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(voterId_); - voterId_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000001; - break; - } - case 18: { - RegistryMessages.GroupID.Builder subBuilder = null; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - subBuilder = groupId_.toBuilder(); - } - groupId_ = input.readMessage(RegistryMessages.GroupID.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(groupId_); - groupId_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000002; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return RegistryMessages.internal_static_VoterGroup_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return RegistryMessages.internal_static_VoterGroup_fieldAccessorTable - .ensureFieldAccessorsInitialized( - RegistryMessages.VoterGroup.class, RegistryMessages.VoterGroup.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public VoterGroup parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new VoterGroup(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int VOTERID_FIELD_NUMBER = 1; - private RegistryMessages.VoterID voterId_; - /** - * required .VoterID voterId = 1; - */ - public boolean hasVoterId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required .VoterID voterId = 1; - */ - public RegistryMessages.VoterID getVoterId() { - return voterId_; - } - /** - * required .VoterID voterId = 1; - */ - public RegistryMessages.VoterIDOrBuilder getVoterIdOrBuilder() { - return voterId_; - } - - public static final int GROUPID_FIELD_NUMBER = 2; - private RegistryMessages.GroupID groupId_; - /** - * required .GroupID groupId = 2; - */ - public boolean hasGroupId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required .GroupID groupId = 2; - */ - public RegistryMessages.GroupID getGroupId() { - return groupId_; - } - /** - * required .GroupID groupId = 2; - */ - public RegistryMessages.GroupIDOrBuilder getGroupIdOrBuilder() { - return groupId_; - } - - private void initFields() { - voterId_ = RegistryMessages.VoterID.getDefaultInstance(); - groupId_ = RegistryMessages.GroupID.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasVoterId()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasGroupId()) { - memoizedIsInitialized = 0; - return false; - } - if (!getVoterId().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - if (!getGroupId().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, voterId_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, groupId_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, voterId_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, groupId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static RegistryMessages.VoterGroup parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static RegistryMessages.VoterGroup parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static RegistryMessages.VoterGroup parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static RegistryMessages.VoterGroup parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static RegistryMessages.VoterGroup parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static RegistryMessages.VoterGroup parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static RegistryMessages.VoterGroup parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static RegistryMessages.VoterGroup parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static RegistryMessages.VoterGroup parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static RegistryMessages.VoterGroup parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(RegistryMessages.VoterGroup prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code VoterGroup} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:VoterGroup) - RegistryMessages.VoterGroupOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return RegistryMessages.internal_static_VoterGroup_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return RegistryMessages.internal_static_VoterGroup_fieldAccessorTable - .ensureFieldAccessorsInitialized( - RegistryMessages.VoterGroup.class, RegistryMessages.VoterGroup.Builder.class); - } - - // Construct using RegistryMessages.VoterGroup.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getVoterIdFieldBuilder(); - getGroupIdFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (voterIdBuilder_ == null) { - voterId_ = RegistryMessages.VoterID.getDefaultInstance(); - } else { - voterIdBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (groupIdBuilder_ == null) { - groupId_ = RegistryMessages.GroupID.getDefaultInstance(); - } else { - groupIdBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return RegistryMessages.internal_static_VoterGroup_descriptor; - } - - public RegistryMessages.VoterGroup getDefaultInstanceForType() { - return RegistryMessages.VoterGroup.getDefaultInstance(); - } - - public RegistryMessages.VoterGroup build() { - RegistryMessages.VoterGroup result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public RegistryMessages.VoterGroup buildPartial() { - RegistryMessages.VoterGroup result = new RegistryMessages.VoterGroup(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (voterIdBuilder_ == null) { - result.voterId_ = voterId_; - } else { - result.voterId_ = voterIdBuilder_.build(); - } - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (groupIdBuilder_ == null) { - result.groupId_ = groupId_; - } else { - result.groupId_ = groupIdBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof RegistryMessages.VoterGroup) { - return mergeFrom((RegistryMessages.VoterGroup)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(RegistryMessages.VoterGroup other) { - if (other == RegistryMessages.VoterGroup.getDefaultInstance()) return this; - if (other.hasVoterId()) { - mergeVoterId(other.getVoterId()); - } - if (other.hasGroupId()) { - mergeGroupId(other.getGroupId()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasVoterId()) { - - return false; - } - if (!hasGroupId()) { - - return false; - } - if (!getVoterId().isInitialized()) { - - return false; - } - if (!getGroupId().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - RegistryMessages.VoterGroup parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (RegistryMessages.VoterGroup) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private RegistryMessages.VoterID voterId_ = RegistryMessages.VoterID.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - RegistryMessages.VoterID, RegistryMessages.VoterID.Builder, RegistryMessages.VoterIDOrBuilder> voterIdBuilder_; - /** - * required .VoterID voterId = 1; - */ - public boolean hasVoterId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required .VoterID voterId = 1; - */ - public RegistryMessages.VoterID getVoterId() { - if (voterIdBuilder_ == null) { - return voterId_; - } else { - return voterIdBuilder_.getMessage(); - } - } - /** - * required .VoterID voterId = 1; - */ - public Builder setVoterId(RegistryMessages.VoterID value) { - if (voterIdBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - voterId_ = value; - onChanged(); - } else { - voterIdBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - /** - * required .VoterID voterId = 1; - */ - public Builder setVoterId( - RegistryMessages.VoterID.Builder builderForValue) { - if (voterIdBuilder_ == null) { - voterId_ = builderForValue.build(); - onChanged(); - } else { - voterIdBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - /** - * required .VoterID voterId = 1; - */ - public Builder mergeVoterId(RegistryMessages.VoterID value) { - if (voterIdBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - voterId_ != RegistryMessages.VoterID.getDefaultInstance()) { - voterId_ = - RegistryMessages.VoterID.newBuilder(voterId_).mergeFrom(value).buildPartial(); - } else { - voterId_ = value; - } - onChanged(); - } else { - voterIdBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - /** - * required .VoterID voterId = 1; - */ - public Builder clearVoterId() { - if (voterIdBuilder_ == null) { - voterId_ = RegistryMessages.VoterID.getDefaultInstance(); - onChanged(); - } else { - voterIdBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - /** - * required .VoterID voterId = 1; - */ - public RegistryMessages.VoterID.Builder getVoterIdBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getVoterIdFieldBuilder().getBuilder(); - } - /** - * required .VoterID voterId = 1; - */ - public RegistryMessages.VoterIDOrBuilder getVoterIdOrBuilder() { - if (voterIdBuilder_ != null) { - return voterIdBuilder_.getMessageOrBuilder(); - } else { - return voterId_; - } - } - /** - * required .VoterID voterId = 1; - */ - private com.google.protobuf.SingleFieldBuilder< - RegistryMessages.VoterID, RegistryMessages.VoterID.Builder, RegistryMessages.VoterIDOrBuilder> - getVoterIdFieldBuilder() { - if (voterIdBuilder_ == null) { - voterIdBuilder_ = new com.google.protobuf.SingleFieldBuilder< - RegistryMessages.VoterID, RegistryMessages.VoterID.Builder, RegistryMessages.VoterIDOrBuilder>( - getVoterId(), - getParentForChildren(), - isClean()); - voterId_ = null; - } - return voterIdBuilder_; - } - - private RegistryMessages.GroupID groupId_ = RegistryMessages.GroupID.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - RegistryMessages.GroupID, RegistryMessages.GroupID.Builder, RegistryMessages.GroupIDOrBuilder> groupIdBuilder_; - /** - * required .GroupID groupId = 2; - */ - public boolean hasGroupId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required .GroupID groupId = 2; - */ - public RegistryMessages.GroupID getGroupId() { - if (groupIdBuilder_ == null) { - return groupId_; - } else { - return groupIdBuilder_.getMessage(); - } - } - /** - * required .GroupID groupId = 2; - */ - public Builder setGroupId(RegistryMessages.GroupID value) { - if (groupIdBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - groupId_ = value; - onChanged(); - } else { - groupIdBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * required .GroupID groupId = 2; - */ - public Builder setGroupId( - RegistryMessages.GroupID.Builder builderForValue) { - if (groupIdBuilder_ == null) { - groupId_ = builderForValue.build(); - onChanged(); - } else { - groupIdBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * required .GroupID groupId = 2; - */ - public Builder mergeGroupId(RegistryMessages.GroupID value) { - if (groupIdBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - groupId_ != RegistryMessages.GroupID.getDefaultInstance()) { - groupId_ = - RegistryMessages.GroupID.newBuilder(groupId_).mergeFrom(value).buildPartial(); - } else { - groupId_ = value; - } - onChanged(); - } else { - groupIdBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * required .GroupID groupId = 2; - */ - public Builder clearGroupId() { - if (groupIdBuilder_ == null) { - groupId_ = RegistryMessages.GroupID.getDefaultInstance(); - onChanged(); - } else { - groupIdBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - /** - * required .GroupID groupId = 2; - */ - public RegistryMessages.GroupID.Builder getGroupIdBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getGroupIdFieldBuilder().getBuilder(); - } - /** - * required .GroupID groupId = 2; - */ - public RegistryMessages.GroupIDOrBuilder getGroupIdOrBuilder() { - if (groupIdBuilder_ != null) { - return groupIdBuilder_.getMessageOrBuilder(); - } else { - return groupId_; - } - } - /** - * required .GroupID groupId = 2; - */ - private com.google.protobuf.SingleFieldBuilder< - RegistryMessages.GroupID, RegistryMessages.GroupID.Builder, RegistryMessages.GroupIDOrBuilder> - getGroupIdFieldBuilder() { - if (groupIdBuilder_ == null) { - groupIdBuilder_ = new com.google.protobuf.SingleFieldBuilder< - RegistryMessages.GroupID, RegistryMessages.GroupID.Builder, RegistryMessages.GroupIDOrBuilder>( - getGroupId(), - getParentForChildren(), - isClean()); - groupId_ = null; - } - return groupIdBuilder_; - } - - // @@protoc_insertion_point(builder_scope:VoterGroup) - } - - static { - defaultInstance = new VoterGroup(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:VoterGroup) - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_VoterID_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_VoterID_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_VoterInfo_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_VoterInfo_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_GroupID_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_GroupID_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_VoterGroup_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_VoterGroup_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\026RegistryMessages.proto\"\025\n\007VoterID\022\n\n\002i" + - "d\030\001 \002(\t\"/\n\tVoterInfo\022\024\n\002id\030\001 \002(\0132\010.Voter" + - "ID\022\014\n\004info\030\002 \002(\t\"\025\n\007GroupID\022\n\n\002id\030\001 \002(\t\"" + - "B\n\nVoterGroup\022\031\n\007voterId\030\001 \002(\0132\010.VoterID" + - "\022\031\n\007groupId\030\002 \002(\0132\010.GroupID" - }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); - internal_static_VoterID_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_VoterID_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_VoterID_descriptor, - new java.lang.String[] { "Id", }); - internal_static_VoterInfo_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_VoterInfo_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_VoterInfo_descriptor, - new java.lang.String[] { "Id", "Info", }); - internal_static_GroupID_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_GroupID_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_GroupID_descriptor, - new java.lang.String[] { "Id", }); - internal_static_VoterGroup_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_VoterGroup_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_VoterGroup_descriptor, - new java.lang.String[] { "VoterId", "GroupId", }); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/voter-registry/src/main/java/meerkat/SimpleRegistry.java b/voter-registry/src/main/java/meerkat/SimpleRegistry.java index e04dd66..762a9a0 100644 --- a/voter-registry/src/main/java/meerkat/SimpleRegistry.java +++ b/voter-registry/src/main/java/meerkat/SimpleRegistry.java @@ -6,6 +6,8 @@ import meerkat.crypto.DigitalSignature; import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; import meerkat.protobuf.BulletinBoardAPI.UnsignedBulletinBoardMessage; import meerkat.protobuf.Crypto; +import meerkat.protobuf.VoterRegistry.*; + import java.io.InputStream; import java.security.SignatureException; @@ -63,7 +65,7 @@ public class SimpleRegistry implements VoterRegistry{ bulletinBoardClient .postMessage(Message, callback); } - public void AddVoter(RegistryMessages.VoterInfo voterInfo, RegistryCallBack callback) { + public void AddVoter(VoterInfo voterInfo, RegistryCallBack callback) { UnsignedBulletinBoardMessage.Builder basicMessage = UnsignedBulletinBoardMessage.newBuilder(). addTag(RegistryTags.ID_TAG + voterInfo.getId().getId()) @@ -75,7 +77,7 @@ public class SimpleRegistry implements VoterRegistry{ SafePost(CreateBulletinBoardMessage(basicMessage.build()), new BooleanCallBack(callback)); } - public void AddToGroup(RegistryMessages.VoterGroup voterGroup, RegistryCallBack callback) { + public void AddToGroup(VoterGroup voterGroup, RegistryCallBack callback) { UnsignedBulletinBoardMessage.Builder basicMessage = UnsignedBulletinBoardMessage.newBuilder() .addTag(RegistryTags.ID_TAG + voterGroup.getVoterId().getId()) @@ -86,7 +88,7 @@ public class SimpleRegistry implements VoterRegistry{ SafePost(CreateBulletinBoardMessage(basicMessage.build()), new BooleanCallBack(callback)); } - public void SetVoted(RegistryMessages.VoterID voterId, RegistryCallBack callback) { + public void SetVoted(VoterID voterId, RegistryCallBack callback) { UnsignedBulletinBoardMessage.Builder basicMessage = UnsignedBulletinBoardMessage.newBuilder() .addTag(RegistryTags.ID_TAG + voterId.getId()) @@ -96,7 +98,7 @@ public class SimpleRegistry implements VoterRegistry{ SafePost(CreateBulletinBoardMessage(basicMessage.build()), new BooleanCallBack(callback)); } - public void GetGroups(RegistryMessages.GroupID groupID, RegistryCallBack callback) { + public void GetGroups(GroupID groupID, RegistryCallBack callback) { List GroupsActionsTags = new ArrayList() {{ add(RegistryTags.GROUP_ID_TAG + groupID.getId()); }}; @@ -104,7 +106,7 @@ public class SimpleRegistry implements VoterRegistry{ new RelevantDataCallBack(callback, signer, signature, certificateStream)); } - public void GetPersonIDDetails(RegistryMessages.VoterID voterID, RegistryCallBack callback) { + public void GetPersonIDDetails(VoterID voterID, RegistryCallBack callback) { List GroupsActionsTags = new ArrayList() {{ add(RegistryTags.ID_TAG + voterID.getId()); add(RegistryTags.VOTER_ENTRY_TAG.toString()); diff --git a/voter-registry/src/main/java/meerkat/VoterRegistry.java b/voter-registry/src/main/java/meerkat/VoterRegistry.java index 9160d32..8a65996 100644 --- a/voter-registry/src/main/java/meerkat/VoterRegistry.java +++ b/voter-registry/src/main/java/meerkat/VoterRegistry.java @@ -1,5 +1,7 @@ package meerkat; +import meerkat.protobuf.VoterRegistry.*; + /** * Created by Vladimir Eliezer Tokarev on 1/22/2016. * provides voters management options @@ -22,7 +24,7 @@ public interface VoterRegistry { * @param callBack when the adding voter done callBack.HandleResult will be called * @return void */ - void AddVoter(RegistryMessages.VoterInfo voterInfo, RegistryCallBack callBack); + void AddVoter(VoterInfo voterInfo, RegistryCallBack callBack); /** * Adding given voter to given group @@ -32,7 +34,7 @@ public interface VoterRegistry { * @param callBack when the adding voter done callBack.HandleResult will be called * @return true if the adding action succeeded else return false */ - void AddToGroup(RegistryMessages.VoterGroup voterGroup, RegistryCallBack callBack); + void AddToGroup(VoterGroup voterGroup, RegistryCallBack callBack); /** * Sets that the voter have voted @@ -42,7 +44,7 @@ public interface VoterRegistry { * @param callBack when the adding voter done callBack.HandleResult will be called * @return true if the set voted succeed else false */ - void SetVoted(RegistryMessages.VoterID voterId, RegistryCallBack callBack); + void SetVoted(VoterID voterId, RegistryCallBack callBack); /** * Requests all the groups that the given id voter is in @@ -51,7 +53,7 @@ public interface VoterRegistry { * @param groupID id tag string * @param callBack when the adding voter done callBack.HandleResult will be called */ - void GetGroups(RegistryMessages.GroupID groupID, RegistryCallBack callBack); + void GetGroups(GroupID groupID, RegistryCallBack callBack); /** * Retrieves list of strings that represents voter @@ -61,6 +63,6 @@ public interface VoterRegistry { * @param callBack when the adding voter done callBack.HandleResult will be called * @return list of strings (empty list if the lookup failed) */ - void GetPersonIDDetails(RegistryMessages.VoterID voterID, RegistryCallBack callBack); + void GetPersonIDDetails(VoterID voterID, RegistryCallBack callBack); } diff --git a/voter-registry/src/test/java/SimpleRegistryTest.java b/voter-registry/src/test/java/SimpleRegistryTest.java index 97c5412..9b75d29 100644 --- a/voter-registry/src/test/java/SimpleRegistryTest.java +++ b/voter-registry/src/test/java/SimpleRegistryTest.java @@ -2,9 +2,9 @@ import com.google.protobuf.InvalidProtocolBufferException; import junit.framework.TestCase; import meerkat.Registry.CollectionMessagesUtils; import meerkat.Registry.RegistryTags; -import meerkat.RegistryMessages; -import meerkat.SimpleRegistry; import meerkat.VoterRegistry; +import meerkat.SimpleRegistry; +import meerkat.protobuf.VoterRegistry.*; import meerkat.VoterRegistryMessage; import meerkat.bulletinboard.BulletinBoardClient; import meerkat.bulletinboard.ThreadedBulletinBoardClient; @@ -167,8 +167,7 @@ public class SimpleRegistryTest extends TestCase { String id = new BigInteger(130, random).toString(32); String data = new BigInteger(130, random).toString(32); - RegistryMessages.VoterInfo voterInfo = RegistryMessages.VoterInfo.newBuilder(). - setId(RegistryMessages.VoterID.newBuilder().setId(id)).setInfo(data).build(); + VoterInfo voterInfo = VoterInfo.newBuilder().setId(VoterID.newBuilder().setId(id)).setInfo(data).build(); SimpleRegistry registry = new SimpleRegistry(signer, bulletinBoardClient, certStream); registry.AddVoter(voterInfo, handler); @@ -196,7 +195,7 @@ public class SimpleRegistryTest extends TestCase { DummyRegistryCallBackHandler handler = new DummyRegistryCallBackHandler<>(); String id = new BigInteger(130, random).toString(32); - RegistryMessages.VoterID voterInfo = RegistryMessages.VoterID.newBuilder().setId(id).build(); + VoterID voterInfo = VoterID.newBuilder().setId(id).build(); SimpleRegistry registry = new SimpleRegistry(signer, bulletinBoardClient, certStream); registry.SetVoted(voterInfo, handler); @@ -224,9 +223,8 @@ public class SimpleRegistryTest extends TestCase { String voterId = new BigInteger(130, random).toString(32); String groupId = new BigInteger(130, random).toString(32); - RegistryMessages.VoterGroup voterInfo = RegistryMessages.VoterGroup.newBuilder() - .setVoterId(RegistryMessages.VoterID.newBuilder().setId(voterId)) - .setGroupId(RegistryMessages.GroupID.newBuilder().setId(groupId)).build(); + VoterGroup voterInfo = VoterGroup.newBuilder().setVoterId(VoterID.newBuilder().setId(voterId)) + .setGroupId(GroupID.newBuilder().setId(groupId)).build(); SimpleRegistry registry = new SimpleRegistry(signer, bulletinBoardClient, certStream); registry.AddToGroup(voterInfo, handler); @@ -258,9 +256,8 @@ public class SimpleRegistryTest extends TestCase { String voterId = new BigInteger(130, random).toString(32); String groupId = new BigInteger(130, random).toString(32); - RegistryMessages.VoterGroup voterInfo = RegistryMessages.VoterGroup.newBuilder() - .setVoterId(RegistryMessages.VoterID.newBuilder().setId(voterId)) - .setGroupId(RegistryMessages.GroupID.newBuilder().setId(groupId)).build(); + VoterGroup voterInfo = VoterGroup.newBuilder().setVoterId(VoterID.newBuilder().setId(voterId)) + .setGroupId(GroupID.newBuilder().setId(groupId)).build(); this.certStream = getClass().getResourceAsStream(CERT1_PEM_EXAMPLE); @@ -271,7 +268,7 @@ public class SimpleRegistryTest extends TestCase { assertEquals(1, handler.counter ); DummyRegistryCallBackHandler> groupsHandler = new DummyRegistryCallBackHandler<>(); - registry.GetGroups(RegistryMessages.GroupID.newBuilder().setId(groupId).build(), groupsHandler); + registry.GetGroups(GroupID.newBuilder().setId(groupId).build(), groupsHandler); jobSemaphore.acquire(1); List userGroups = groupsHandler.data; @@ -288,8 +285,7 @@ public class SimpleRegistryTest extends TestCase { String id = new BigInteger(130, random).toString(32); String data = new BigInteger(130, random).toString(32); - RegistryMessages.VoterInfo voterInfo = RegistryMessages.VoterInfo.newBuilder(). - setId(RegistryMessages.VoterID.newBuilder().setId(id)).setInfo(data).build(); + VoterInfo voterInfo = VoterInfo.newBuilder().setId(VoterID.newBuilder().setId(id)).setInfo(data).build(); SimpleRegistry registry = new SimpleRegistry(signer, bulletinBoardClient, certStream); registry.AddVoter(voterInfo, handler); @@ -298,7 +294,7 @@ public class SimpleRegistryTest extends TestCase { assertEquals(1, handler.counter ); DummyRegistryCallBackHandler personalHandler = new DummyRegistryCallBackHandler<>(); - registry.GetPersonIDDetails(RegistryMessages.VoterID.newBuilder().setId(id).build(), personalHandler); + registry.GetPersonIDDetails(VoterID.newBuilder().setId(id).build(), personalHandler); jobSemaphore.acquire(); assertEquals(RegistryTags.ID_TAG + id,