devicemap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wk...@apache.org
Subject svn commit: r1648143 - /devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java
Date Sun, 28 Dec 2014 02:44:44 GMT
Author: wkeil
Date: Sun Dec 28 02:44:44 2014
New Revision: 1648143

URL: http://svn.apache.org/r1648143
Log:
DMAP-111: Improve Web Examples 

Task-Url: https://issues.apache.org/jira/browse/DMAP-111

Modified:
    devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java

Modified: devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java?rev=1648143&r1=1648142&r2=1648143&view=diff
==============================================================================
--- devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java
(original)
+++ devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java
Sun Dec 28 02:44:44 2014
@@ -36,6 +36,7 @@ public class AndroidDeviceBuilder extend
 
     public AndroidDeviceBuilder() {
         super();
+//        System.out.println("Constructor");
     }
 
     public boolean canBuild(UserAgent userAgent) {
@@ -48,12 +49,16 @@ public class AndroidDeviceBuilder extend
     }
 
     public Device build(UserAgent userAgent, int confidenceTreshold) {
+    	System.out.println("Building");
+    	System.out.println("UA: " + userAgent.getCompleteUserAgent() + " :: A=" + userAgent.containsAndroid());
         ArrayList<Device> foundDevices = new ArrayList<Device>();
         Iterator it = orderedRules.keySet().iterator();
         while (it.hasNext()) {
             String token = (String) it.next();
+//            System.out.println(token);
             Device d = elaborateAndroidDeviceWithToken(userAgent, token);
             if (d != null) {
+            	System.out.println(token);
                 if (d.getConfidence() > confidenceTreshold) {
                     return d;
 
@@ -83,13 +88,13 @@ public class AndroidDeviceBuilder extend
             String looseToken = token.replaceAll("[ _/-]", ".?");
 
             Pattern loosePattern = Pattern.compile("(?i).*" + looseToken + ".*");
-
+System.out.println("Loose Pattern: " + loosePattern);
             if (!loosePattern.matcher(userAgent.getCompleteUserAgent().replaceAll("Android",
"")).matches()) {
                 return null;
             }
 
             String patternElementInsideClean = cleanPatternElementInside(userAgent.getPatternElementsInside());
-
+//System.out.println("Pattern: " + patternElementInsideClean);
             Pattern currentPattern = null;
 
             for (int i = 0; i <= 1; i++) {
@@ -98,9 +103,10 @@ public class AndroidDeviceBuilder extend
                 }
 
                 currentPattern = Pattern.compile("(?i).*" + currentToken + ".?Build/.*");
+//System.out.println("Pattern: " + currentPattern);
                 if (patternElementInsideClean != null && currentPattern.matcher(patternElementInsideClean).matches())
{//&& userAgent.getPatternElementsInside().matches(".*" + currentToken + ".?Build/.*"))
{
                     String deviceId = (String) orderedRules.get(token);
-
+//System.out.println("DID: " + deviceId);
 		    if (devices.containsKey(deviceId)) {
                         Device retDevice = (Device) devices.get(deviceId).clone();
                         retDevice.setConfidence(100 - subtract);



Mime
View raw message