All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ircclouds.irc.api.domain.IRCUserStatuses Maven / Gradle / Ivy

There is a newer version: 1.0-0014
Show newest version
package com.ircclouds.irc.api.domain;

import java.util.*;

public class IRCUserStatuses implements Iterable
{
	private Set userStatuses;

	public IRCUserStatuses(Set aUserStatuses)
	{
		userStatuses = aUserStatuses;
	}
	
	public boolean isEmpty()
	{
		return userStatuses.isEmpty();
	}

	@Override
	public Iterator iterator()
	{
		return Collections.unmodifiableSet(userStatuses).iterator();
	}
	
	public boolean contains(Character aChanMode)
	{
		for (IRCUserStatus _ucs : userStatuses)
		{
			if (_ucs.getChanModeType().equals(aChanMode))
			{
				return true;
			}
		}
		
		return false;
	}
	
	public IRCUserStatus getUserStatus(Character aChanMode)
	{
		for (IRCUserStatus _ucs : userStatuses)
		{
			if (_ucs.getChanModeType().equals(aChanMode))
			{
				return _ucs;
			}
		}
		
		return null;
	}
	
	public static IRCUserStatus getDominantUserStatus(Set aUserStatuses)
	{
		IRCUserStatus _ucs = null;
		int _priority = Integer.MAX_VALUE;
		
		for (IRCUserStatus _tmp : aUserStatuses)
		{
			if (_tmp.getPriority() < _priority)
			{
				_priority = _tmp.getPriority();
				_ucs = _tmp;
			}
		}
		
		return _ucs;
	}
	
	public String toString()
	{
		return userStatuses.toString();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy