Examples of DevicePattern


Examples of com.volantis.devrep.repository.impl.devices.DevicePattern

        boolean foundMatch = false;
        String deviceName = null;

        if (devicePatternIterator != null) {
            while(devicePatternIterator.hasNext() && !foundMatch) {
                DevicePattern currentDevicePattern =
                        (DevicePattern)devicePatternIterator.next();

                if (currentDevicePattern.match(userAgentString)) {
                    foundMatch = true;
                    deviceName = currentDevicePattern.getDeviceName();
                }
            }
        }
        return deviceName;
    }
View Full Code Here

Examples of com.volantis.devrep.repository.impl.devices.DevicePattern

        Integer key = getPatternMapKey(pattern, true, 0);
        TreeSet set = (TreeSet) cache.get(key);
        if (set == null) {
            set = new TreeSet();
        }
        set.add(new DevicePattern(pattern, deviceName));
        cache.put(key, set);
    }
View Full Code Here

Examples of com.volantis.devrep.repository.impl.devices.DevicePattern

            }

            TreeSet set = (TreeSet) cache.get(key);
            Iterator it = set.iterator();
            while (it.hasNext()) {
                DevicePattern value = (DevicePattern) it.next();
                if (logger.isDebugEnabled()) {
                    logger.debug(" , " + keyValue +
                                 " , " + subKey +
                                 " , " + set.size() +
                                 " , " + value.getDeviceName() +
                                 " , " + value.getPattern()
                    );
                }
            }
        }
    }
View Full Code Here

Examples of net.sf.uadetector.internal.data.domain.DevicePattern

      } else if (NAME.getName().equals(entry.getKey())) {
        b.setName(entry.getValue().getAsString());
      } else if (PATTERNS.getName().equals(entry.getKey())) {
        final SortedSet<DevicePattern> patterns = new TreeSet<DevicePattern>();
        for (final JsonElement patternHash : entry.getValue().getAsJsonArray()) {
          final DevicePattern pattern = devicePatternDeserializer.findDevicePattern(patternHash.getAsString());
          if (pattern != null) {
            patterns.add(pattern);
          }
        }
        b.setPatterns(patterns);
View Full Code Here

Examples of net.sf.uadetector.internal.data.domain.DevicePattern

    final int id = 1;
    final Category category = Category.PERSONAL_COMPUTER;
    final String icon = "icon";
    final String infoUrl = "info url";
    final SortedSet<DevicePattern> patterns = new TreeSet<DevicePattern>();
    patterns.add(new DevicePattern(1, Pattern.compile("[0-9]"), 1));
    patterns.add(new DevicePattern(2, Pattern.compile("[a-z]"), 2));
    return new Device(name, id, category, icon, infoUrl, patterns);
  }
View Full Code Here

Examples of net.sf.uadetector.internal.data.domain.DevicePattern

      }
    }
    final int id = counter.incrementAndGet();

    // create device pattern
    DevicePattern devicePattern = null;
    try {
      devicePattern = new DevicePattern(id, pattern, id);

      // check hash when option is set
      checkHash(json, hash, devicePattern);

      // add pattern to map
View Full Code Here

Examples of net.sf.uadetector.internal.data.domain.DevicePattern

  }

  @Nullable
  public DevicePattern findDevicePattern(@Nonnull final String hash) {
    Check.notEmpty(hash, "hash");
    final DevicePattern devicePattern = devicePatterns.get(hash);
    if (devicePattern == null) {
      addWarning("Can not find device pattern for hash '" + hash + "'.");
    }
    return devicePattern;
  }
View Full Code Here

Examples of net.sf.uadetector.internal.data.domain.DevicePattern

    patternToBrowserMap.put(browserPattern, browser);

    browserToOperatingSystemMappings.add(new BrowserOperatingSystemMapping(browser.getId(), operatingSystem.getId()));

    final TreeSet<DevicePattern> devicePatternSet = Sets.newTreeSet();
    final DevicePattern devicePattern = new DevicePattern(1, Pattern.compile("[a-z]+"), 1);
    devicePatternSet.add(devicePattern);
    devicePatterns.put(1, devicePatternSet);

    final Device device = new Device("device-category-name", 1, Category.OTHER, "device.png", "device-info", devicePatternSet);
    devices.add(device);
View Full Code Here

Examples of net.sf.uadetector.internal.data.domain.DevicePattern

  @Test
  public void equals_different_DEVICEPATTERNS() {
    final Map<Integer, SortedSet<DevicePattern>> patterns1 = Maps.newHashMap();
    final TreeSet<DevicePattern> pattern1 = Sets.newTreeSet();
    pattern1.add(new DevicePattern(1, Pattern.compile("1"), 1));
    patterns1.put(1, pattern1);
    final Data a = new DataBlueprint().devicePatterns(patterns1).build();

    final Map<Integer, SortedSet<DevicePattern>> patterns2 = Maps.newHashMap();
    final TreeSet<DevicePattern> pattern2 = Sets.newTreeSet();
    pattern2.add(new DevicePattern(1, Pattern.compile("2"), 1));
    patterns2.put(1, pattern2);
    final Data b = new DataBlueprint().devicePatterns(patterns2).build();

    assertThat(a.equals(b)).isFalse();
    assertThat(a.hashCode() == b.hashCode()).isFalse();
View Full Code Here

Examples of net.sf.uadetector.internal.data.domain.DevicePattern

    assertThat(a.hashCode() == b.hashCode()).isFalse();
  }

  @Test
  public void equals_different_PATTERNTODEVICEMAP() {
    final DevicePattern pattern1 = new DevicePattern(1, Pattern.compile("1"), 1);
    final Device device1 = new Device("dev1", 234, Category.OTHER, "icon", "infoUrl", new TreeSet<DevicePattern>());
    final SortedMap<DevicePattern, Device> map1 = Maps.newTreeMap();
    map1.put(pattern1, device1);
    final Data a = new DataBlueprint().patternToDeviceMap(map1).build();

    final DevicePattern pattern2 = new DevicePattern(1, Pattern.compile("2"), 1);
    final Device device2 = new Device("dev2", 235, Category.OTHER, "icon", "infoUrl", new TreeSet<DevicePattern>());
    final SortedMap<DevicePattern, Device> map2 = Maps.newTreeMap();
    map2.put(pattern2, device2);
    final Data b = new DataBlueprint().patternToDeviceMap(map2).build();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.