class MessageFilter {

    public boolean acceptMessage(Message message) {
        if (commands.isEmpty()) {
            return true;
        }

        String command = String.valueOf(message.getCommand());

        if (commands.contains(command)) {
            return true;
        }

        if (!(message instanceof UscMessage)) {
            return false;
        }

        String messageType = String.valueOf(((UscMessage)message).getMessage().getMessageType());

        for (String cmd : commands) {
            if (!cmd.contains(":")) {
                continue;
            }

            String[] parts = cmd.split("\\:");

            if (parts.length != 2) {
                continue;
            }

            if (!parts[0].equals(command)) {
                continue;
            }

            if (parts[1].equals(messageType)) {
                return true;
            }
        }

        return false;
    }

    public  MessageFilter(List<String> commands);

}