diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-05 14:16:35 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-11-05 14:55:15 +0200 |
commit | b73db446ac9681fdfc4ad602c6da7ce3e36a8588 (patch) | |
tree | 6107f4347c188f4c14840c01167b2f05b2f5ad48 /xmerge | |
parent | dfcb982ae8810e22204bc15fd7c119a903900a53 (diff) |
java: combine nested if statements
Change-Id: I0457b81668e9427a3c8d6a4af93438b7fb2bb7ba
Diffstat (limited to 'xmerge')
5 files changed, 27 insertions, 48 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject.java index 212e07ee891a..6ac60f183f13 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject.java @@ -61,11 +61,9 @@ public class EmbeddedBinaryObject extends EmbeddedObject { */ public byte[] getBinaryData() { - if (objData == null) { - // See if we came from a Zip file - if (zipFile != null) { - objData = zipFile.getNamedBytes(objName); - } + // See if we came from a Zip file + if (objData == null && zipFile != null) { + objData = zipFile.getNamedBytes(objName); } return objData; diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java index 26115d4084a5..8875c21c902f 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java @@ -461,10 +461,8 @@ public class TextStyle extends Style implements Cloneable { if (tStyle.values != values) return false; - if (tStyle.sizeInPoints != 0) { - if (sizeInPoints != tStyle.sizeInPoints) - return false; - } + if (tStyle.sizeInPoints != 0 && sizeInPoints != tStyle.sizeInPoints) + return false; if (tStyle.fontName != null) { if (fontName == null) @@ -498,29 +496,23 @@ public class TextStyle extends Style implements Cloneable { */ private void writeAttributes(Element node) { - if ((mask & BOLD) != 0) - if ((values & BOLD) != 0) - node.setAttribute("fo:font-weight", "bold"); + if ((mask & BOLD) != 0 && (values & BOLD) != 0) + node.setAttribute("fo:font-weight", "bold"); - if ((mask & ITALIC) != 0) - if ((values & ITALIC) != 0) - node.setAttribute("fo:font-style", "italic"); + if ((mask & ITALIC) != 0 && (values & ITALIC) != 0) + node.setAttribute("fo:font-style", "italic"); - if ((mask & UNDERLINE) != 0) - if ((values & UNDERLINE) != 0) - node.setAttribute("style:text-underline", "single"); + if ((mask & UNDERLINE) != 0 && (values & UNDERLINE) != 0) + node.setAttribute("style:text-underline", "single"); - if ((mask & STRIKETHRU) != 0) - if ((values & STRIKETHRU) != 0) - node.setAttribute("style:text-crossing-out", "single-line"); + if ((mask & STRIKETHRU) != 0 && (values & STRIKETHRU) != 0) + node.setAttribute("style:text-crossing-out", "single-line"); - if ((mask & SUPERSCRIPT) != 0) - if ((values & SUPERSCRIPT) != 0) - node.setAttribute("style:text-position", "super 58%"); + if ((mask & SUPERSCRIPT) != 0 && (values & SUPERSCRIPT) != 0) + node.setAttribute("style:text-position", "super 58%"); - if ((mask & SUBSCRIPT) != 0) - if ((values & SUBSCRIPT) != 0) - node.setAttribute("style:text-position", "sub 58%"); + if ((mask & SUBSCRIPT) != 0 && (values & SUBSCRIPT) != 0) + node.setAttribute("style:text-position", "sub 58%"); if (sizeInPoints != 0) { node.setAttribute("fo:font-size", Integer.toString(sizeInPoints) + "pt"); diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java index 7015847152a5..0a24044159ea 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java @@ -406,10 +406,8 @@ public class Format { if (rhs.attributes!= attributes) return false; - if (rhs.sizeInPoints != 0) { - if (sizeInPoints != rhs.sizeInPoints) - return false; - } + if (rhs.sizeInPoints != 0 && sizeInPoints != rhs.sizeInPoints) + return false; if (fontName == null ? rhs.fontName != null : !fontName.equals(rhs.fontName)) return false; diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/ConverterCapabilitiesImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/ConverterCapabilitiesImpl.java index 5569af0a8c33..64a94d350168 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/ConverterCapabilitiesImpl.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/ConverterCapabilitiesImpl.java @@ -68,12 +68,7 @@ public final class ConverterCapabilitiesImpl } public boolean canConvertAttribute(String tag, String attribute) { - - if (OfficeConstants.TAG_SPACE.equals(tag)) { - if (OfficeConstants.ATTRIBUTE_SPACE_COUNT.equals(attribute)) - return true; - } - - return false; + return OfficeConstants.TAG_SPACE.equals(tag) + && OfficeConstants.ATTRIBUTE_SPACE_COUNT.equals(attribute); } }
\ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java index 4599a0e49c23..ed95031f8a24 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java @@ -203,10 +203,8 @@ public final class Debug { * @param msg The message. */ public static void log(int flag, String msg) { - if (isFlagSet(flag)) { - if (writer != null) { - writer.println(msg); - } + if (isFlagSet(flag) && writer != null) { + writer.println(msg); } } @@ -223,12 +221,10 @@ public final class Debug { * @param e Throwable object. */ public static void log(int flag, String msg, Throwable e) { - if (isFlagSet(flag)) { - if (writer != null) { - writer.println(msg); - if (e != null) - e.printStackTrace(writer); - } + if (isFlagSet(flag) && writer != null) { + writer.println(msg); + if (e != null) + e.printStackTrace(writer); } } }
\ No newline at end of file |