From 4324bdeecdc4e65b3403e79556045598121936e5 Mon Sep 17 00:00:00 2001 From: Vladimir Eliezer Tokarev Date: Fri, 22 Jan 2016 06:23:25 -0800 Subject: [PATCH] Changed the SimpleRegistry and VoterRegistryMessage Documentation The documentation was partial in part of the methods --- .../src/main/java/meerkat/SimpleRegistry.java | 26 +++++++++++-------- .../java/meerkat/VoterRegistryMessage.java | 4 +-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/voter-registry/src/main/java/meerkat/SimpleRegistry.java b/voter-registry/src/main/java/meerkat/SimpleRegistry.java index d841929..82fdd02 100644 --- a/voter-registry/src/main/java/meerkat/SimpleRegistry.java +++ b/voter-registry/src/main/java/meerkat/SimpleRegistry.java @@ -32,6 +32,11 @@ public class SimpleRegistry { this.communicator = communicator; } + /** + * Creates array of Tags in given length + * @param length the length og wanted array + * @return Tag.Builder[] + */ private Tag.Builder[] GetTagsArrayInLength(int length) { Tag.Builder[] tags = new Tag.Builder[length]; @@ -96,18 +101,17 @@ public class SimpleRegistry { private List GetRelevantVoterRegistryMessages(List tags) throws InvalidProtocolBufferException { List relevantMessages = GetRelevantMessages(tags); List messages = CollectionMessagesUtils.GetBasicMessagesFromBulletinBoardMessages(relevantMessages); - List voterRegistryMessages = CollectionMessagesUtils.ConvertToVoterRegistryMessages(messages); - - return voterRegistryMessages; + return CollectionMessagesUtils.ConvertToVoterRegistryMessages(messages); } + /** * Adds new voter to the bulletin-board * - * @param voterID + * @param voterID id of the new user * @param personalData for example residence location * @return void - * @throws throws CommunicationException + * @throws CommunicationException, IOException */ public void AddVoter(String voterID, String personalData) throws CommunicationException, IOException { Tag.Builder[] tags = GetTagsArrayInLength(3); @@ -124,8 +128,8 @@ public class SimpleRegistry { /** * Adding given voter to given group * - * @param voterID - * @param groupID + * @param voterID the voter id + * @param groupID the group id to which we want add the voter * @return true if the adding action succeeded else return false * @throws CommunicationException */ @@ -145,8 +149,8 @@ public class SimpleRegistry { /** * Removes given voter from given group * - * @param voterID - * @param groupID + * @param voterID the voter id + * @param groupID the group from which we want to remove the user * @return true if the removing action succeeded else return false * @throws CommunicationException */ @@ -190,7 +194,7 @@ public class SimpleRegistry { * @throws CommunicationException, InvalidProtocolBufferException */ public List GetGroups(String id) throws CommunicationException, InvalidProtocolBufferException { - List GroupsActionsTags = new ArrayList(); + List GroupsActionsTags = new ArrayList<>(); GroupsActionsTags.add(Tag.newBuilder().setContent(RegistryTags.ID_TAG + " " + id).build()); GroupsActionsTags.add(Tag.newBuilder().setContent(RegistryTags.GROUP_ACTION_TAG + " " + RegistryTags.REMOVE_FROM_GROUP_TAG).build()); GroupsActionsTags.add(Tag.newBuilder().setContent(RegistryTags.GROUP_ACTION_TAG + " " + RegistryTags.ADD_TO_GROUP_TAG).build()); @@ -213,7 +217,7 @@ public class SimpleRegistry { * @throws CommunicationException */ public List GetPersonIDDetails(String id) throws CommunicationException, InvalidProtocolBufferException, ParseException { - List GroupsActionsTags = new ArrayList(); + List GroupsActionsTags = new ArrayList<>(); GroupsActionsTags.add(Tag.newBuilder().setContent(RegistryTags.ID_TAG + " " + id).build()); GroupsActionsTags.add(Tag.newBuilder().setContent(RegistryTags.VOTER_ENTRY_TAG.toString()).build()); diff --git a/voter-registry/src/main/java/meerkat/VoterRegistryMessage.java b/voter-registry/src/main/java/meerkat/VoterRegistryMessage.java index 1115e4f..70162a0 100644 --- a/voter-registry/src/main/java/meerkat/VoterRegistryMessage.java +++ b/voter-registry/src/main/java/meerkat/VoterRegistryMessage.java @@ -20,7 +20,7 @@ public class VoterRegistryMessage { /** * Gets the wanted tag from given basic message - * @param tagName + * @param tagName the name of the tag * @return string */ public String GetWantedTagFromBasicMessage(RegistryTags tagName){ @@ -51,7 +51,7 @@ public class VoterRegistryMessage { /** * Checks if the given message have the ADD_TO_GROUP_TAG - * @return + * @return true when ADD_TO_GROUP_TAG exist else false */ public boolean IsGroupAdding() { for (ProtobufsMessages.Tag tag : base.getTagList()) {