/* * Jeti, a Java Jabber client, Copyright (C) 2001 E.S. de Boer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * For questions, comments etc, * use the website at http://jeti.jabberstudio.org * or mail/IM me at jeti@jabber.org */ package nu.fw.jeti.backend.roster; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import nu.fw.jeti.jabber.JIDStatus; /** * Title: im * Description: * Copyright: Copyright (c) 2001 * Company: * @author E.S. de Boer * @version 1.0 */ public class JIDStatusGroup implements Comparable { // synchronized because used in event thread & jabberinput thread private String name; private List members; private int onlines; public JIDStatusGroup(String name) { this.name = name; members = new ArrayList(16); } public synchronized int size() { return members.size(); } // public boolean isOffline() // { // for(Iterator i = members.iterator();i.hasNext();) // { // if(((JIDStatus)i.next()).isOnline()) return false; // } // return true; // } public synchronized void addOnline() {onlines++;} public synchronized void removeOnline() {onlines--;} public synchronized int getOnlines() {return onlines;} public Iterator iterator() { return new ArrayList(members).iterator(); } /* public void addJIDStatus(JIDStatus2 jid) { members.add(jid); Collections.sort(members); } */ public synchronized void addPrimaryJIDStatus(PrimaryJIDStatus jid) { members.add(jid); Collections.sort(members); } /* public void sort() { Collections.sort(members); } */ public synchronized Object getPrimaryJIDStatus(int index) { return members.get(index); } /* public JIDStatus searchJID(JID jid) { for(int tel =0; tel