1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Phase 1 of large refactoring. Removing dead code, bug fixes, updates to JDK 1.5.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@4511 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2006-07-17 08:39:08 +00:00 committed by matt
parent 1a08715f67
commit bbbfe09c31
62 changed files with 291 additions and 3524 deletions

View file

@ -106,21 +106,20 @@ public class RosterEntry {
}
/**
* Returns an iterator for all the roster groups that this entry belongs to.
* Returns an unmodifiable collection of the roster groups that this entry belongs to.
*
* @return an iterator for the groups this entry belongs to.
*/
public Iterator getGroups() {
List results = new ArrayList();
public Collection<RosterGroup> getGroups() {
List<RosterGroup> results = new ArrayList<RosterGroup>();
// Loop through all roster groups and find the ones that contain this
// entry. This algorithm should be fine
for (Iterator i=connection.roster.getGroups(); i.hasNext(); ) {
RosterGroup group = (RosterGroup)i.next();
for (RosterGroup group: connection.roster.getGroups()) {
if (group.contains(this)) {
results.add(group);
}
}
return results.iterator();
return Collections.unmodifiableCollection(results);
}
/**
@ -152,14 +151,15 @@ public class RosterEntry {
buf.append(name).append(": ");
}
buf.append(user);
Iterator groups = getGroups();
if (groups.hasNext()) {
Collection<RosterGroup> groups = getGroups();
if (!groups.isEmpty()) {
buf.append(" [");
RosterGroup group = (RosterGroup)groups.next();
Iterator<RosterGroup> iter = groups.iterator();
RosterGroup group = iter.next();
buf.append(group.getName());
while (groups.hasNext()) {
while (iter.hasNext()) {
buf.append(", ");
group = (RosterGroup)groups.next();
group = iter.next();
buf.append(group.getName());
}
buf.append("]");
@ -184,8 +184,7 @@ public class RosterEntry {
item.setItemType(entry.getType());
item.setItemStatus(entry.getStatus());
// Set the correct group names for the item.
for (Iterator j=entry.getGroups(); j.hasNext(); ) {
RosterGroup group = (RosterGroup)j.next();
for (RosterGroup group : entry.getGroups()) {
item.addGroupName(group.getName());
}
return item;