예제 #1
0
  public UserAgent(String userAgentString) {
    String userAgentLowercaseString =
        userAgentString == null ? null : userAgentString.toLowerCase();
    Browser browser = Browser.parseUserAgentLowercaseString(userAgentLowercaseString);

    OperatingSystem operatingSystem = OperatingSystem.UNKNOWN;

    // BOTs don't have an interesting OS for us
    if (browser != Browser.BOT)
      operatingSystem = OperatingSystem.parseUserAgentLowercaseString(userAgentLowercaseString);

    this.operatingSystem = operatingSystem;
    this.browser = browser;
    this.id = ((operatingSystem.getId() << 16) + browser.getId());
    this.userAgentString = userAgentString;
  }
예제 #2
0
 public UserAgent(OperatingSystem operatingSystem, Browser browser) {
   this.operatingSystem = operatingSystem;
   this.browser = browser;
   this.id = ((operatingSystem.getId() << 16) + browser.getId());
 }