package com.ircclouds.irc.api.om;

import java.util.*;

import com.ircclouds.irc.api.domain.messages.*;
import com.ircclouds.irc.api.domain.messages.interfaces.*;

public abstract class AbstractNoticeBuilder implements IBuilder<IMessage>
{
	public IMessage build(AbstractMessage aMessage)
	{
        if (aMessage.prefix == null || !aMessage.prefix.contains("@")) {
            return new ServerNotice(aMessage);
        }

        if (getChannelTypes().contains(aMessage.params.get(0).charAt(0))) {
            return new ChannelNotice(aMessage);
        }

		return new UserNotice(aMessage);
	}
	
	protected abstract Set<Character> getChannelTypes();
}

@@ -221,17 +221,24 @@
 Builder%3C
-I
+Abstract
 Message%3E
@@ -248,17 +248,24 @@
 %09public 
-I
+Abstract
 Message 

Tweak AbstractNoticeBuilder to use AbstractMessage instead of IMessage