pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1603539 - in /pdfbox/trunk/pdfbox/src: main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/ main/java/org/apache/pdfbox/pdmodel/encryption/ main/java/org/apache/pdfbox/pdmodel/font/ main/java/org/apache/pdfbox/pdmodel/...
Date Wed, 18 Jun 2014 17:18:04 GMT
Author: tilman
Date: Wed Jun 18 17:18:03 2014
New Revision: 1603539

URL: http://svn.apache.org/r1603539
Log:
PDFBOX-2147: replace redundant if statements

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/AccessPermission.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontManager.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/GouraudTriangle.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestPDNumberTreeNode.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java?rev=1603539&r1=1603538&r2=1603539&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java
Wed Jun 18 17:18:03 2014
@@ -178,11 +178,7 @@ public abstract class PDAttributeObject 
     {
         if (oldValue == null)
         {
-            if (newValue == null)
-            {
-                return false;
-            }
-            return true;
+            return newValue != null;
         }
         return !oldValue.equals(newValue);
     }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java?rev=1603539&r1=1603538&r2=1603539&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java
Wed Jun 18 17:18:03 2014
@@ -179,11 +179,7 @@ public class PDUserProperty extends PDDi
     {
         if (oldEntry == null)
         {
-            if (newEntry == null)
-            {
-                return false;
-            }
-            return true;
+            return newEntry != null;
         }
         return !oldEntry.equals(newEntry);
     }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/AccessPermission.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/AccessPermission.java?rev=1603539&r1=1603538&r2=1603539&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/AccessPermission.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/AccessPermission.java
Wed Jun 18 17:18:03 2014
@@ -438,10 +438,6 @@ public class AccessPermission
         {
             return true;
         }
-        if (canPrintDegraded())
-        {
-            return true;
-        }
-        return false;
+        return canPrintDegraded();
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontManager.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontManager.java?rev=1603539&r1=1603538&r2=1603539&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontManager.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontManager.java Wed
Jun 18 17:18:03 2014
@@ -319,11 +319,7 @@ public class FontManager 
             return true;
         }
         String psname = font.getPSName().toLowerCase();
-        if (psname.indexOf("bold") > -1)
-        {
-            return true;
-        }
-        return false;
+        return psname.indexOf("bold") > -1;
     }
     
     /**
@@ -342,10 +338,6 @@ public class FontManager 
             return true;
         }
         String psname = font.getPSName().toLowerCase();
-        if (psname.indexOf("italic") > -1 || psname.indexOf("oblique") > -1)
-        {
-            return true;
-        }
-        return false;
+        return psname.indexOf("italic") > -1 || psname.indexOf("oblique") > -1;
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/GouraudTriangle.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/GouraudTriangle.java?rev=1603539&r1=1603538&r2=1603539&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/GouraudTriangle.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/GouraudTriangle.java
Wed Jun 18 17:18:03 2014
@@ -104,12 +104,7 @@ class GouraudTriangle
             return false;
         }
 
-        if ((xCminusB * (p.getY() - pointB.getY()) - yCminusB * (p.getX() - pointB.getX())
> 0) != signAB)
-        {
-            return false;
-        }
-
-        return true;
+        return (xCminusB * (p.getY() - pointB.getY()) - yCminusB * (p.getX() - pointB.getX())
> 0) == signAB;
     }
 
     // returns the area of a triangle

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestPDNumberTreeNode.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestPDNumberTreeNode.java?rev=1603539&r1=1603538&r2=1603539&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestPDNumberTreeNode.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestPDNumberTreeNode.java
Wed Jun 18 17:18:03 2014
@@ -76,9 +76,7 @@ public class TestPDNumberTreeNode extend
             if ( getClass() != obj.getClass())
                 return false;
             PDTest other = (PDTest) obj;
-            if ( value != other.value)
-                return false;
-            return true;
+            return value == other.value;
         }
     }
 

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java?rev=1603539&r1=1603538&r2=1603539&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java Wed Jun
18 17:18:03 2014
@@ -175,18 +175,8 @@ public class TestTextStripper extends Te
                 }
             }
         }
-        else if( ( expected == null && actual != null && actual.trim().isEmpty(
 ) ) ||
-            ( actual == null && expected != null && expected.trim().isEmpty(
 ) ) )
-        {
-            //basically there are some cases where pdfbox will put an extra line
-            //at the end of the file, who cares, this is not enough to report
-            // a failure
-            equals = true;
-        }
-        else
-        {
-            equals = false;
-        }
+        else equals = ( expected == null && actual != null && actual.trim().isEmpty(
 ) ) ||
+                ( actual == null && expected != null && expected.trim().isEmpty(
 ) );
         return equals;
     }
 



Mime
View raw message