From bb4cc5b08796d27516d5a343f2381666274ed00c Mon Sep 17 00:00:00 2001 From: Vladimir Eliezer Tokarev Date: Fri, 19 Feb 2016 06:17:43 -0800 Subject: [PATCH] Refactoring the code of voter-registry according to Arbel Peled CR --- .gitignore | 7 +- Wombat Code And Documentation Conventions | 10 - voter-registry/.gitignore | 6 +- .../main/java/meerkat/RegistryCallBack.java | 47 - .../main/java/meerkat/RegistryInstance.java | 66 - .../main/java/meerkat/RegistryMessages.java | 2470 +++++++++++++++++ .../src/main/java/meerkat/SimpleRegistry.java | 134 +- .../src/main/java/meerkat/VoterRegistry.java | 66 + .../java/meerkat/VoterRegistryMessage.java | 7 +- .../java/util/CollectionMessagesUtils.java | 2 +- .../util/SimpleRegistryCallBackHandler.java | 60 - .../src/main/java/util/VoterAdded.java | 18 + .../src/test/java/SimpleRegistryTest.java | 16 +- 13 files changed, 2608 insertions(+), 301 deletions(-) delete mode 100644 Wombat Code And Documentation Conventions delete mode 100644 voter-registry/src/main/java/meerkat/RegistryCallBack.java delete mode 100644 voter-registry/src/main/java/meerkat/RegistryInstance.java create mode 100644 voter-registry/src/main/java/meerkat/RegistryMessages.java create mode 100644 voter-registry/src/main/java/meerkat/VoterRegistry.java delete mode 100644 voter-registry/src/main/java/util/SimpleRegistryCallBackHandler.java create mode 100644 voter-registry/src/main/java/util/VoterAdded.java diff --git a/.gitignore b/.gitignore index 08eb1bd..069ccc6 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,5 @@ out *.prefs *.project *.classpath -bulletin-board-server/local-instances/meerkat.db -/SQLiteDBTest.db -/bulletin-board-server/SQLiteDBTest.db -arcanist/* -libphutil/* \ No newline at end of file +*.db +Wombat Code And Documentation Conventions \ No newline at end of file diff --git a/Wombat Code And Documentation Conventions b/Wombat Code And Documentation Conventions deleted file mode 100644 index f26d866..0000000 --- a/Wombat Code And Documentation Conventions +++ /dev/null @@ -1,10 +0,0 @@ -This file describes Wombat Code & Documentation Conventions: - -Code Conventions: - * Code- The good old classic java code conventions - camelCase convention, constants should be capital letters with underscore etc... - -Documentation Conventions: - * Comments- The good old classic java code documentation, Block Comments (to describe - method/class/interface etc...) // comments too describe complex code - (only if the code block complicated) diff --git a/voter-registry/.gitignore b/voter-registry/.gitignore index 2df19de..60125a7 100644 --- a/voter-registry/.gitignore +++ b/voter-registry/.gitignore @@ -1,8 +1,4 @@ -/protoc.exe /bin/ -/comment-info.txt -/main/java/meerkat/manualTests.* -/SQLiteDBTest.db -/bulletin-board-server/SQLiteDBTest.db +*.db /src/main/java/meerkat/manualTests.java /.gitignore diff --git a/voter-registry/src/main/java/meerkat/RegistryCallBack.java b/voter-registry/src/main/java/meerkat/RegistryCallBack.java deleted file mode 100644 index fb6090e..0000000 --- a/voter-registry/src/main/java/meerkat/RegistryCallBack.java +++ /dev/null @@ -1,47 +0,0 @@ -package meerkat; - -import java.util.List; - -/** - * Created by Vladimir Eliezer Tokarev on 1/22/2016. - * Those methods will be called when their parallel methods ends running - * parallel means for instance first some registry will post voter then call HandleVoterPosted - */ -public interface RegistryCallBack { - - /** - * Runs logic after voter have been posted - * @param succeeded shows if the adding of the voter succeeded - */ - void HandleVoterAdded(boolean succeeded); - - /** - * Runs logic after voter have been removed form group - * @param succeeded shows if the removing of the voter succeeded - */ - void HandleVoterAddedToGroup(boolean succeeded); - - /** - * Runs logic after voter have been added form group - * @param succeeded shows if the adding of the voter succeeded - */ - void HandleVoterRemovedFromGroup(boolean succeeded); - - /** - * Runs logic after voter have voted - * @param succeeded shows if the voter voting have been documented successfully - */ - void HandleSetVoted(boolean succeeded); - - /** - * Handles the voter information - * @param voterInformation list of information of the voter (its id, and personal data) - */ - void HandleVoterInfo(List voterInformation); - - /** - * Handles the groups the voter in - * @param groupsVoterIn list of groups ids of the voter - */ - void HandleVoterGroups(List groupsVoterIn); -} diff --git a/voter-registry/src/main/java/meerkat/RegistryInstance.java b/voter-registry/src/main/java/meerkat/RegistryInstance.java deleted file mode 100644 index 857a7e7..0000000 --- a/voter-registry/src/main/java/meerkat/RegistryInstance.java +++ /dev/null @@ -1,66 +0,0 @@ -package meerkat; - -/** - * Created by Vladimir Eliezer Tokarev on 1/22/2016. - * provides voters management options - */ -public interface RegistryInstance { - - /** - * Adds new voter to the bulletin-board - * - * @param voterID id of the new user - * @param personalData for example residence location - * @param callBack when the adding voter done callBack.HandleVoterAdded will be called - * @return void - */ - void AddVoter(String voterID, String personalData, RegistryCallBack callBack); - - /** - * Adding given voter to given group - * - * @param voterID the voter id - * @param groupID the group id to which we want add the voter - * @param callBack when the adding voter done callBack.HandleVoterAddedToGroup will be called - * @return true if the adding action succeeded else return false - */ - void AddToGroup(String voterID, String groupID, RegistryCallBack callBack); - - /** - * Removes given voter from given group - * - * @param voterID the voter id - * @param groupID the group from which we want to remove the user - * @param callBack when the adding voter done callBack.HandleVoterRemovedFromGroup will be called - * @return true if the removing action succeeded else return false - */ - void RemoveFromGroup(String voterID, String groupID, RegistryCallBack callBack); - - /** - * Sets that the voter have voted - * - * @param id id tag string - * @param callBack when the adding voter done callBack.HandleSetVoted will be called - * @return true if the set voted succeed else false - */ - void SetVoted(String id, RegistryCallBack callBack); - - /** - * Requests all the groups that the given id voter is in - * - * @param id id tag string - * @param callBack when the adding voter done callBack.HandleVoterGroups will be called - * @return list of groups ids (or names), if the method fails its empty - */ - void GetGroups(String id, RegistryCallBack callBack); - - /** - * Retrieves list of strings that represents voter - * - * @param id id tag string - * @param callBack when the adding voter done callBack.HandleVoterInfo will be called - * @return list of strings (empty list if the lookup failed) - */ - void GetPersonIDDetails(String id, RegistryCallBack callBack); -} - diff --git a/voter-registry/src/main/java/meerkat/RegistryMessages.java b/voter-registry/src/main/java/meerkat/RegistryMessages.java new file mode 100644 index 0000000..fe22dd8 --- /dev/null +++ b/voter-registry/src/main/java/meerkat/RegistryMessages.java @@ -0,0 +1,2470 @@ +// 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 9d2f473..0c277cc 100644 --- a/voter-registry/src/main/java/meerkat/SimpleRegistry.java +++ b/voter-registry/src/main/java/meerkat/SimpleRegistry.java @@ -1,11 +1,7 @@ package meerkat; -import com.google.protobuf.ByteString; -import com.google.protobuf.InvalidProtocolBufferException; -import meerkat.bulletinboard.SimpleBulletinBoardClient; - -import meerkat.comm.CommunicationException; -import meerkat.crypto.Encryption; +import meerkat.bulletinboard.BulletinBoardClient; +import meerkat.crypto.DigitalSignature; import meerkat.protobuf.BulletinBoardAPI; import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; import meerkat.protobuf.BulletinBoardAPI.MessageFilter; @@ -15,27 +11,23 @@ import meerkat.protobuf.Crypto; import util.AccurateTimestamp; import util.RegistryTags; -import java.io.IOException; -import java.text.ParseException; +import java.security.SignatureException; import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.Random; - -import static util.CollectionMessagesUtils.*; /** * Created by Vladimir Eliezer Tokarev on 1/8/2016. * Gives the ability to synchronously manage voters information */ -public class SimpleRegistry implements RegistryInstance{ +public class SimpleRegistry implements VoterRegistry{ - protected Encryption signatory; - protected SimpleBulletinBoardClient communicator; + protected DigitalSignature signatory; + protected BulletinBoardClient bulletinBoardClient ; + protected RegistryCallBack callback; - public SimpleRegistry(Encryption signatory, SimpleBulletinBoardClient communicator) { + public SimpleRegistry(DigitalSignature signatory, BulletinBoardClient communicator) { this.signatory = signatory; - this.communicator = communicator; + this.bulletinBoardClient = communicator; } /** @@ -49,19 +41,15 @@ public class SimpleRegistry implements RegistryInstance{ BulletinBoardMessage.Builder bulletinBoardMessage = BulletinBoardMessage.newBuilder(); - Crypto.RerandomizableEncryptedMessage encryptedMessage = - signatory.encrypt(basicMessage, signatory.generateRandomness(new Random())); - - Crypto.Signature.Builder messageSignature = Crypto.Signature.newBuilder(); - messageSignature.setType(Crypto.SignatureType.ECDSA) - .setData(encryptedMessage.toByteString()); + signatory.updateContent(basicMessage); + Crypto.Signature signature = signatory.sign(); bulletinBoardMessage.setMsg(basicMessage); - - bulletinBoardMessage.addSig(messageSignature); + bulletinBoardMessage.addSig(signature); return bulletinBoardMessage.build(); - } catch (IOException e) { + } catch (SignatureException e) { + e.printStackTrace(); return null; } } @@ -72,7 +60,7 @@ public class SimpleRegistry implements RegistryInstance{ * @param tags the tags based on which the messages will be filtered * @return MessageFilterList. */ - public MessageFilterList GetRelevantMessages(List tags) { + public MessageFilterList GetRelevantMessagesFilters(List tags) { MessageFilterList.Builder filters = MessageFilterList.newBuilder(); if (tags == null){ @@ -89,105 +77,61 @@ public class SimpleRegistry implements RegistryInstance{ return filters.build(); } - /** - * Gets Relevant bulletinBoard messages from communicator than converts them to VoterRegistryMessages - * - * @param tags list of tags that will be used as filters - * @return List - */ - private List GetRelevantVoterRegistryMessages(List tags) throws InvalidProtocolBufferException { - List relevantMessages = communicator.readMessages(GetRelevantMessages(tags)); - List messages = GetUnsignedBulletinBoardMessages(relevantMessages); - return ConvertToVoterRegistryMessages(messages); - } - /** * Tries to post basicMessage and return true if its been successfully posted * * @param Message the massage to post * @return true when the post was successful else false */ - private boolean SafePost(BulletinBoardMessage Message) { - try { - communicator.postMessage(Message); - return true; - } catch (CommunicationException e) { - return false; - } + private void SafePost(BulletinBoardMessage Message, BulletinBoardClient.ClientCallback callback) { + bulletinBoardClient .postMessage(Message, callback); } - public void AddVoter(String voterID, String personalData, RegistryCallBack callback) { + public void AddVoter(RegistryMessages.VoterInfo voterInfo, RegistryCallBack callback) { UnsignedBulletinBoardMessage.Builder basicMessage = UnsignedBulletinBoardMessage.newBuilder(). - addTag(RegistryTags.ID_TAG + voterID) + addTag(RegistryTags.ID_TAG + voterInfo.getId().getId()) .addTag(RegistryTags.VOTER_ENTRY_TAG.toString()) .addTag(RegistryTags.ACTION_TIMESTAMP_TAG + AccurateTimestamp.GetCurrentTimestampString()); - basicMessage.setData(ByteString.copyFrom(personalData.getBytes())); + basicMessage.setData(voterInfo.getInfoBytes()); - callback.HandleVoterAdded(SafePost(CreateBulletinBoardMessage(basicMessage.build()))); + SafePost(CreateBulletinBoardMessage(basicMessage.build()), new BooleanHandler(callback)); } - public void AddToGroup(String voterID, String groupID, RegistryCallBack callback) { + public void AddToGroup(RegistryMessages.VoterGroup voterGroup, RegistryCallBack callback) { UnsignedBulletinBoardMessage.Builder basicMessage = UnsignedBulletinBoardMessage.newBuilder() - .addTag(RegistryTags.ID_TAG + voterID) - .addTag(RegistryTags.GROUP_ID_TAG + groupID) + .addTag(RegistryTags.ID_TAG + voterGroup.getVoterId().getId()) + .addTag(RegistryTags.GROUP_ID_TAG + voterGroup.getGroupId().getId()) .addTag(RegistryTags.GROUP_ACTION_TAG .toString() + RegistryTags.ADD_TO_GROUP_TAG) .addTag(RegistryTags.ACTION_TIMESTAMP_TAG + AccurateTimestamp.GetCurrentTimestampString()); - callback.HandleVoterAddedToGroup(SafePost(CreateBulletinBoardMessage(basicMessage.build()))); + SafePost(CreateBulletinBoardMessage(basicMessage.build()), new BooleanHandler(callback)); } - public void RemoveFromGroup(String voterID, String groupID, RegistryCallBack callback) { + public void SetVoted(RegistryMessages.VoterID voterId, RegistryCallBack callback) { UnsignedBulletinBoardMessage.Builder basicMessage = UnsignedBulletinBoardMessage.newBuilder() - .addTag(RegistryTags.ID_TAG + voterID) - .addTag(RegistryTags.GROUP_ID_TAG + groupID) - .addTag(RegistryTags.GROUP_ACTION_TAG.toString()+ RegistryTags.REMOVE_FROM_GROUP_TAG) - .addTag(RegistryTags.ACTION_TIMESTAMP_TAG + AccurateTimestamp.GetCurrentTimestampString()); - - callback.HandleVoterRemovedFromGroup(SafePost(CreateBulletinBoardMessage(basicMessage.build()))); - } - - public void SetVoted(String id, RegistryCallBack callback) { - UnsignedBulletinBoardMessage.Builder basicMessage = - UnsignedBulletinBoardMessage.newBuilder() - .addTag(RegistryTags.ID_TAG + id) + .addTag(RegistryTags.ID_TAG + voterId.getId()) .addTag(RegistryTags.VOTE_ACTION_TAG.toString()) .addTag(RegistryTags.ACTION_TIMESTAMP_TAG + AccurateTimestamp.GetCurrentTimestampString()); - callback.HandleVoterAddedToGroup(SafePost(CreateBulletinBoardMessage(basicMessage.build()))); + SafePost(CreateBulletinBoardMessage(basicMessage.build()), new BooleanHandler(callback)); } - public void GetGroups(String id, RegistryCallBack callback) { - try { - List GroupsActionsTags = new ArrayList() {{ - add(RegistryTags.GROUP_ID_TAG + id); - }}; - List voterRegistryMessages = GetRelevantVoterRegistryMessages(GroupsActionsTags); - - Map groupIdToMessage = GetLatestGroupsActions(voterRegistryMessages); - - callback.HandleVoterGroups(GetListOfGroupIds(groupIdToMessage)); - } catch (ParseException | InvalidProtocolBufferException e) { - callback.HandleVoterGroups(null); - } + public void GetGroups(RegistryMessages.GroupID groupID, RegistryCallBack callback) { + List GroupsActionsTags = new ArrayList() {{ + add(RegistryTags.GROUP_ID_TAG + groupID.getId()); + }}; + bulletinBoardClient.readMessages(GetRelevantMessagesFilters(GroupsActionsTags), new RelevantDataCallBack(callback)); } - public void GetPersonIDDetails(String id, RegistryCallBack callback) { - try { - List GroupsActionsTags = new ArrayList() {{ - add(RegistryTags.ID_TAG + id); - add(RegistryTags.VOTER_ENTRY_TAG.toString()); - }}; - List voterRegistryMessages = GetRelevantVoterRegistryMessages(GroupsActionsTags); - - VoterRegistryMessage LatestMessage = GetLatestMessage(voterRegistryMessages); - - callback.HandleVoterInfo(LatestMessage.tagsToStringList()); - } catch (InvalidProtocolBufferException | ParseException e ){ - callback.HandleVoterInfo(null); - } + public void GetPersonIDDetails(RegistryMessages.VoterID voterID, RegistryCallBack callback) { + List GroupsActionsTags = new ArrayList() {{ + add(RegistryTags.ID_TAG + voterID.getId()); + add(RegistryTags.VOTER_ENTRY_TAG.toString()); + }}; + bulletinBoardClient.readMessages(GetRelevantMessagesFilters(GroupsActionsTags), new PersonalDataCallBack(callback)); } } diff --git a/voter-registry/src/main/java/meerkat/VoterRegistry.java b/voter-registry/src/main/java/meerkat/VoterRegistry.java new file mode 100644 index 0000000..9160d32 --- /dev/null +++ b/voter-registry/src/main/java/meerkat/VoterRegistry.java @@ -0,0 +1,66 @@ +package meerkat; + +/** + * Created by Vladimir Eliezer Tokarev on 1/22/2016. + * provides voters management options + */ +public interface VoterRegistry { + + /** + * Created by Vladimir Eliezer Tokarev on 1/22/2016. + * This interface will handle the end of methods of RegistryInstance + */ + interface RegistryCallBack { + void HandleResult(T result); + } + + /** + * Adds new voter to the bulletin-board + * Passes true to callBack.HandleResult if the actions succeeded else false + * + * @param voterInfo protobuff object that represents voter information + * @param callBack when the adding voter done callBack.HandleResult will be called + * @return void + */ + void AddVoter(RegistryMessages.VoterInfo voterInfo, RegistryCallBack callBack); + + /** + * Adding given voter to given group + * Passes the group to callBack.HandleResult if the actions succeeded else null + * + * @param voterGroup protobuff object that is coupling of voterId to groupId + * @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); + + /** + * Sets that the voter have voted + * Passes true to callBack.HandleResult if the actions succeeded else false + * + * @param voterId id tag string + * @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); + + /** + * Requests all the groups that the given id voter is in + * Passes wanted groups to callback.HandleResult if the actions succeeded else null + * + * @param groupID id tag string + * @param callBack when the adding voter done callBack.HandleResult will be called + */ + void GetGroups(RegistryMessages.GroupID groupID, RegistryCallBack callBack); + + /** + * Retrieves list of strings that represents voter + * Passes wanted data to callback.HandleResult if the actions succeeded else null + * + * @param voterID id tag string + * @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); +} + diff --git a/voter-registry/src/main/java/meerkat/VoterRegistryMessage.java b/voter-registry/src/main/java/meerkat/VoterRegistryMessage.java index 052cd0f..1d9bb73 100644 --- a/voter-registry/src/main/java/meerkat/VoterRegistryMessage.java +++ b/voter-registry/src/main/java/meerkat/VoterRegistryMessage.java @@ -16,9 +16,10 @@ public class VoterRegistryMessage { public BulletinBoardAPI.UnsignedBulletinBoardMessage base; - public VoterRegistryMessage(BulletinBoardAPI.UnsignedBulletinBoardMessage message) { - BulletinBoardAPI.UnsignedBulletinBoardMessage.Builder unsignedBase = BulletinBoardAPI.UnsignedBulletinBoardMessage.newBuilder().addAllTag(message.getTagList()); - unsignedBase.setData(message.getData()); + public VoterRegistryMessage(BulletinBoardAPI.BulletinBoardMessage message) { + BulletinBoardAPI.UnsignedBulletinBoardMessage.Builder unsignedBase = + BulletinBoardAPI.UnsignedBulletinBoardMessage.newBuilder().addAllTag(message.getMsg().getTagList()); + unsignedBase.setData(message.getMsg().getData()); base = unsignedBase.build(); } diff --git a/voter-registry/src/main/java/util/CollectionMessagesUtils.java b/voter-registry/src/main/java/util/CollectionMessagesUtils.java index f0d454b..c4d03bb 100644 --- a/voter-registry/src/main/java/util/CollectionMessagesUtils.java +++ b/voter-registry/src/main/java/util/CollectionMessagesUtils.java @@ -23,7 +23,7 @@ public abstract class CollectionMessagesUtils { * @return List */ public static List ConvertToVoterRegistryMessages( - List messages){ + List messages){ return messages.stream().map(VoterRegistryMessage::new).collect(Collectors.toList()); } diff --git a/voter-registry/src/main/java/util/SimpleRegistryCallBackHandler.java b/voter-registry/src/main/java/util/SimpleRegistryCallBackHandler.java deleted file mode 100644 index cd78cd1..0000000 --- a/voter-registry/src/main/java/util/SimpleRegistryCallBackHandler.java +++ /dev/null @@ -1,60 +0,0 @@ -package util; - -import meerkat.RegistryCallBack; - -import java.util.List; - -/** - * Handles the return values from called methods or registry - */ -public class SimpleRegistryCallBackHandler implements RegistryCallBack { - /** - * Presents the state of the called registy method - */ - public boolean ActionSucceed; - - /** - * Presents the wanted information from registry - */ - public List WantedInformation; - - public int counter = 0; - - @Override - public void HandleVoterAdded(boolean succeeded) { - ActionSucceed = succeeded; - counter++; - } - - @Override - public void HandleVoterAddedToGroup(boolean succeeded) { - ActionSucceed = succeeded; - counter++; - } - - @Override - public void HandleVoterRemovedFromGroup(boolean succeeded) { - ActionSucceed = succeeded; - counter++; - } - - @Override - public void HandleSetVoted(boolean succeeded) { - ActionSucceed = succeeded; - counter++; - } - - @Override - public void HandleVoterInfo(List voterInformation) { - ActionSucceed = (voterInformation != null); - WantedInformation = voterInformation; - counter++; - } - - @Override - public void HandleVoterGroups(List groupsVoterIn) { - ActionSucceed = (groupsVoterIn != null); - WantedInformation = groupsVoterIn; - counter++; - } -} diff --git a/voter-registry/src/main/java/util/VoterAdded.java b/voter-registry/src/main/java/util/VoterAdded.java new file mode 100644 index 0000000..36ce74b --- /dev/null +++ b/voter-registry/src/main/java/util/VoterAdded.java @@ -0,0 +1,18 @@ +package util; + + +import meerkat.VoterRegistry; + +/** + * Handles the return value of the AddVoter method of + */ +public class VoterAdded implements VoterRegistry.RegistryCallBack { + public boolean Data; + + @Override + public void HandleResult(Boolean result) { + Data = result; + } +} + + diff --git a/voter-registry/src/test/java/SimpleRegistryTest.java b/voter-registry/src/test/java/SimpleRegistryTest.java index b75d8ad..fd38885 100644 --- a/voter-registry/src/test/java/SimpleRegistryTest.java +++ b/voter-registry/src/test/java/SimpleRegistryTest.java @@ -1,6 +1,5 @@ import com.google.protobuf.InvalidProtocolBufferException; import junit.framework.TestCase; -import meerkat.RegistryCallBack; import meerkat.SimpleRegistry; import meerkat.VoterRegistryMessage; import meerkat.bulletinboard.SimpleBulletinBoardClient; @@ -12,7 +11,6 @@ import meerkat.protobuf.Voting; import org.factcenter.qilin.primitives.concrete.ECElGamal; import org.factcenter.qilin.primitives.concrete.ECGroup; import util.RegistryTags; -import util.SimpleRegistryCallBackHandler; import java.lang.reflect.InvocationTargetException; import java.math.BigInteger; @@ -66,8 +64,8 @@ public class SimpleRegistryTest extends TestCase { } - private SimpleRegistryCallBackHandler RegistryAnswersHandlerSetup() { - return new SimpleRegistryCallBackHandler(); + private SimpleRegistryCallBackHandlers RegistryAnswersHandlerSetup() { + return new SimpleRegistryCallBackHandlers(); } /** @@ -123,7 +121,7 @@ public class SimpleRegistryTest extends TestCase { private int countActualAddedMessages(List> votersData, List tags, SimpleRegistry registry) throws InvalidProtocolBufferException { System.out.println("- Check that the server have the new voters data:"); - BulletinBoardAPI.MessageFilterList filters = registry.GetRelevantMessages(tags); + BulletinBoardAPI.MessageFilterList filters = registry.GetRelevantMessagesFilters(tags); List messages = ConvertToVoterRegistryMessages(GetUnsignedBulletinBoardMessages(communicator.readMessages(filters))); @@ -155,7 +153,7 @@ public class SimpleRegistryTest extends TestCase { * @param voterData List of string which is the params to pass to the wantedMethod */ private void CallWantedMethod(String methodToCheck, int numberOfParamsWithoutHandler, - SimpleRegistryCallBackHandler handler, SimpleRegistry registry, + SimpleRegistryCallBackHandlers handler, SimpleRegistry registry, List voterData) { try { if (numberOfParamsWithoutHandler == 1) @@ -186,7 +184,7 @@ public class SimpleRegistryTest extends TestCase { * @throws InvalidProtocolBufferException */ private List> checkMessagesPostedSuccessfully(String methodToCheck, int numberOfParamsToPass, int numberOfChecks, List tags) throws InvalidProtocolBufferException { - SimpleRegistryCallBackHandler handler = RegistryAnswersHandlerSetup(); + SimpleRegistryCallBackHandlers handler = RegistryAnswersHandlerSetup(); System.out.println("Starting testing the " + methodToCheck + " capability."); setActionsData(numberOfParamsToPass, numberOfChecks); @@ -244,7 +242,7 @@ public class SimpleRegistryTest extends TestCase { List> votersData = checkMessagesPostedSuccessfully("AddToGroup", 2, 3, null); SimpleRegistry registry = new SimpleRegistry(signatory, communicator); - SimpleRegistryCallBackHandler handler = RegistryAnswersHandlerSetup(); + SimpleRegistryCallBackHandlers handler = RegistryAnswersHandlerSetup(); System.out.println("- Checks that every group id we added to every voter really exists:"); for (List voterData : votersData){ @@ -268,7 +266,7 @@ public class SimpleRegistryTest extends TestCase { new ArrayList(){{add(RegistryTags.VOTER_ENTRY_TAG.toString());}}); SimpleRegistry registry = new SimpleRegistry(signatory, communicator); - SimpleRegistryCallBackHandler handler = RegistryAnswersHandlerSetup(); + SimpleRegistryCallBackHandlers handler = RegistryAnswersHandlerSetup(); System.out.println("- Check that every added voter can be retrieved by SimpleRegistry:");