package jp.sourceforge.shovel.entity.impl;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import jp.sourceforge.shovel.entity.IClient;

public class OperaImpl extends AbstractClientImpl implements IClient
{
    public String getApplication() {
        return "opera";
    }
    public static IClient testUserAgent(String userAgent) {
        IClient client = null;
        if (userAgent.matches("^mozilla/.+\\(compatible; msie .+;.+\\)")) {
            Matcher m = Pattern.compile("opera ([0-9\\.]+)").matcher(userAgent);
            if (m.find()) {
                client = (IClient)getContainer().getComponent(OperaImpl.class);
                client.setVersion(m.group());
            }
        }
        return client;
    }
}
