From 3faced7068a8401b57be8949e80ce4f4da4a0fb5 Mon Sep 17 00:00:00 2001 From: Frankie B Date: Fri, 10 May 2024 00:32:34 +0100 Subject: Format all code, add editorconfig --- src/com/wilko/jaim/Group.java | 80 ++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 31 deletions(-) (limited to 'src/com/wilko/jaim/Group.java') diff --git a/src/com/wilko/jaim/Group.java b/src/com/wilko/jaim/Group.java index 359e224..5adcdbe 100644 --- a/src/com/wilko/jaim/Group.java +++ b/src/com/wilko/jaim/Group.java @@ -25,72 +25,90 @@ package com.wilko.jaim; -import java.util.Vector; -import java.util.List; import java.util.Enumeration; +import java.util.Vector; -/** This is a logical user group. It holds a set of users. +/** + * This is a logical user group. It holds a set of users. + * * @author Brett Humphreys */ public class Group { - - /** Vector of buddies for this group */ - private Vector buddies = new Vector(); - - /** Name of this group */ - private String groupName; - - /** This constructor sets the name of the group + + /** + * Vector of buddies for this group + */ + private final Vector buddies = new Vector(); + + /** + * Name of this group + */ + private final String groupName; + + /** + * This constructor sets the name of the group + * * @param name the group name */ - public Group( String name ) { + public Group(String name) { groupName = name; } - - /** This method adds a buddy to the end of the group + + /** + * This method adds a buddy to the end of the group + * * @param buddy The buddy object to associate with this group */ public void addBuddy(Buddy buddy) { buddies.add(buddy); } - - /** This method adds a buddy to the specified location in the group - * If the specified location is beyond the end of the group, then the buddy is added to the end of the group + + /** + * This method adds a buddy to the specified location in the group + * If the specified location is beyond the end of the group, then the buddy is added to the end of the group + * * @param buddy The buddy object to associate with this group - * @param pos the position to add the buddy + * @param pos the position to add the buddy */ - public void addBuddy(Buddy buddy,int pos) { + public void addBuddy(Buddy buddy, int pos) { if (pos > buddies.size()) { buddies.add(buddy); - } - else { - buddies.add(pos,buddy); + } else { + buddies.add(pos, buddy); } } - - /** This method gets the group name + + /** + * This method gets the group name + * * @return the group name */ public String getName() { return groupName; } - - /** This method returns the buddies in this group + + /** + * This method returns the buddies in this group + * * @return an Enumeration of {@link Buddy} objects */ public Enumeration enumerateBuddies() { return buddies.elements(); } - - /** This method returns the number of buddies in this group + + /** + * This method returns the number of buddies in this group + * * @return buddy count */ public int getBuddyCount() { - return(buddies.size()); + return (buddies.size()); } - /** This method returns the buddies in this group - * @return a Collection of {@link Buddy} objects + /** + * This method returns the buddies in this group + * + * @return a Collection of {@link Buddy} objects */ public java.util.Collection getBuddies() { java.util.Collection cReturn = new java.util.Vector(buddies); -- cgit v1.2.3-54-g00ecf