diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-20 15:30:36 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-10-07 13:20:02 +0200 |
commit | dc53e3027bb1a278164f15d0a31f20c15608d10e (patch) | |
tree | 84fe7e21121789981ac18e53e1f45453a064e279 | |
parent | 726fc58d0cbdb0fa6d71e5c896889a7c5b64cd9c (diff) |
java: simplify conditions involving logical negation
Change-Id: Ib45e58273e650ef9a31dbdb5f71e995a5976f50e
17 files changed, 26 insertions, 27 deletions
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java index fbaf25e5d9cc..4c273e966bc3 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java @@ -275,8 +275,8 @@ public class SampleHyphenator extends ComponentBase implements // check if hyphenation pos is valid, // a value of -1 indicates that hyphenation is not possible if ( nHyphenationPos != -1 && - !(nHyphenationPos < nHyphMinLeading) && - !(nHyphenationPos >= aWord.length() - nHyphMinTrailing)) + (nHyphenationPos > nHyphMinLeading) && + (nHyphenationPos < aWord.length() - nHyphMinTrailing)) { xRes = new XHyphenatedWord_impl(aWord, aLocale, nHyphenationPos, aHyphenatedWord, nHyphenPos); diff --git a/qadevOOo/runner/convwatch/MSOfficePrint.java b/qadevOOo/runner/convwatch/MSOfficePrint.java index 821678284557..b80bdf57331e 100644 --- a/qadevOOo/runner/convwatch/MSOfficePrint.java +++ b/qadevOOo/runner/convwatch/MSOfficePrint.java @@ -788,7 +788,7 @@ public class MSOfficePrint if (aLine != null) { aLine = aLine.trim(); - if ( (! (aLine.length() < 2) ) && + if ( (aLine.length() >= 2 ) && (! aLine.startsWith("#")) && (! aLine.startsWith(";")) ) { diff --git a/qadevOOo/runner/convwatch/PerformanceContainer.java b/qadevOOo/runner/convwatch/PerformanceContainer.java index 9db65e08b328..f9747fcd017e 100644 --- a/qadevOOo/runner/convwatch/PerformanceContainer.java +++ b/qadevOOo/runner/convwatch/PerformanceContainer.java @@ -161,7 +161,7 @@ public class PerformanceContainer /* extends *//* implements */ { { sLine = aRandomAccessFile.readLine(); if ( (sLine != null) && - (! (sLine.length() < 2) ) && + (sLine.length() >= 2 ) && (! sLine.startsWith("#"))) { if (sLine.startsWith("WordStartTime=")) diff --git a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java index aeebf6927588..9e2a9c38ced1 100644 --- a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java +++ b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java @@ -635,7 +635,7 @@ public class MSOfficePostscriptCreator implements IOffice if (aLine != null) { aLine = aLine.trim(); - if ( (! (aLine.length() < 2) ) && + if ( (aLine.length() >= 2 ) && (! aLine.startsWith("#")) && (! aLine.startsWith(";")) ) { diff --git a/qadevOOo/runner/graphical/PerformanceContainer.java b/qadevOOo/runner/graphical/PerformanceContainer.java index 9291d01b5c00..e21f68432be5 100644 --- a/qadevOOo/runner/graphical/PerformanceContainer.java +++ b/qadevOOo/runner/graphical/PerformanceContainer.java @@ -177,7 +177,7 @@ public class PerformanceContainer /* extends *//* implements */ { { sLine = aRandomAccessFile.readLine(); if ( (sLine != null) && - (! (sLine.length() < 2) ) && + (sLine.length() >= 2 ) && (! sLine.startsWith("#"))) { if (sLine.startsWith("WordStartTime=")) diff --git a/qadevOOo/runner/helper/OfficeProvider.java b/qadevOOo/runner/helper/OfficeProvider.java index d5ac4bacbaf1..58fdd0126756 100644 --- a/qadevOOo/runner/helper/OfficeProvider.java +++ b/qadevOOo/runner/helper/OfficeProvider.java @@ -671,7 +671,7 @@ public class OfficeProvider implements AppProvider if (sep.equalsIgnoreCase("\\")) { - if (!(idx2 < 0)) + if (idx2 >= 0) { sysDir = sysDir.substring(1); } diff --git a/qadevOOo/tests/java/ifc/sheet/_XAreaLink.java b/qadevOOo/tests/java/ifc/sheet/_XAreaLink.java index ea20c57ff3ec..c5026eb692f0 100644 --- a/qadevOOo/tests/java/ifc/sheet/_XAreaLink.java +++ b/qadevOOo/tests/java/ifc/sheet/_XAreaLink.java @@ -49,7 +49,7 @@ public class _XAreaLink extends MultiMethodTest { log.println("testing getDestArea()"); boolean bResult = false; oORAdd = oObj.getDestArea(); - if (!(oORAdd == null)){ bResult = true; } + if (oORAdd != null){ bResult = true; } tRes.tested("getDestArea()", bResult) ; } @@ -63,7 +63,7 @@ public class _XAreaLink extends MultiMethodTest { boolean bResult = false; String src = null; src = oObj.getSourceArea() ; - if (!(src == null)){ bResult = true; } + if (src != null){ bResult = true; } tRes.tested("getSourceArea()", bResult) ; } diff --git a/qadevOOo/tests/java/ifc/sheet/_XScenarioEnhanced.java b/qadevOOo/tests/java/ifc/sheet/_XScenarioEnhanced.java index 162121cf76e6..e573ea45f63d 100644 --- a/qadevOOo/tests/java/ifc/sheet/_XScenarioEnhanced.java +++ b/qadevOOo/tests/java/ifc/sheet/_XScenarioEnhanced.java @@ -40,35 +40,35 @@ public class _XScenarioEnhanced extends MultiMethodTest { CellRangeAddress first = getting[0]; - if (!(first.Sheet == 1)) { + if (first.Sheet != 1) { log.println( "wrong RangeAddress is returned, expected Sheet=0 and got " + first.Sheet); res = false; } - if (!(first.StartColumn == 0)) { + if (first.StartColumn != 0) { log.println( "wrong RangeAddress is returned, expected StartColumn=0 and got " + first.StartColumn); res = false; } - if (!(first.EndColumn == 10)) { + if (first.EndColumn != 10) { log.println( "wrong RangeAddress is returned, expected EndColumn=10 and got " + first.EndColumn); res = false; } - if (!(first.StartRow == 0)) { + if (first.StartRow != 0) { log.println( "wrong RangeAddress is returned, expected StartRow=0 and got " + first.StartRow); res = false; } - if (!(first.EndRow == 10)) { + if (first.EndRow != 10) { log.println( "wrong RangeAddress is returned, expected EndRow=10 and got " + first.EndRow); diff --git a/qadevOOo/tests/java/ifc/table/_XCellCursor.java b/qadevOOo/tests/java/ifc/table/_XCellCursor.java index ff7971ad57fc..9c2591f91c42 100644 --- a/qadevOOo/tests/java/ifc/table/_XCellCursor.java +++ b/qadevOOo/tests/java/ifc/table/_XCellCursor.java @@ -77,7 +77,7 @@ public class _XCellCursor extends MultiMethodTest { oAddr = oRange.getRangeAddress(); startCol2 = oAddr.StartColumn; - if (!(startCol == startCol2)){ + if (startCol != startCol2){ bResult = true; } tRes.tested( "gotoNext()", bResult ); @@ -105,7 +105,7 @@ public class _XCellCursor extends MultiMethodTest { oAddr = oRange.getRangeAddress(); startRow2 = oAddr.StartRow; startCol2 = oAddr.StartColumn; - if (!(startCol == startCol2) || (startRow == startRow2)){ + if ((startCol != startCol2) || (startRow == startRow2)){ bResult = true; } tRes.tested( "gotoOffset()", bResult ); @@ -131,7 +131,7 @@ public class _XCellCursor extends MultiMethodTest { oAddr = oRange.getRangeAddress(); startCol2 = oAddr.StartColumn; - if (!(startCol == startCol2)){ + if (startCol != startCol2){ bResult = true; } tRes.tested( "gotoPrevious()", bResult ); diff --git a/qadevOOo/tests/java/ifc/util/_XSearchDescriptor.java b/qadevOOo/tests/java/ifc/util/_XSearchDescriptor.java index b9a8f558ed4d..bc7fc151073b 100644 --- a/qadevOOo/tests/java/ifc/util/_XSearchDescriptor.java +++ b/qadevOOo/tests/java/ifc/util/_XSearchDescriptor.java @@ -49,7 +49,7 @@ public class _XSearchDescriptor extends MultiMethodTest { log.println("test for getSearchString() "); searchStr = oObj.getSearchString(); - if (!(searchStr == null)){ bResult = true; } + if (searchStr != null){ bResult = true; } tRes.tested("getSearchString()", bResult); } diff --git a/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java b/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java index 969f79119f5b..05384a76f1dd 100644 --- a/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java +++ b/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java @@ -117,8 +117,7 @@ public class UCBStreamHandler extends URLStreamHandler { try { String sUrl = url.toString(); - - if (!(sUrl.lastIndexOf(separator) == -1)) { + if ( sUrl.lastIndexOf(separator) != -1 ) { String path = sUrl.substring(0, sUrl.lastIndexOf(separator)); if (m_xSimpleFileAccess.isReadOnly(path)) { diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java index 4b994ac667d9..a098eea1484b 100644 --- a/wizards/com/sun/star/wizards/db/QueryMetaData.java +++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java @@ -125,7 +125,7 @@ public class QueryMetaData extends CommandMetaData for (int n = 0; n < FieldColumns.length; n++) { String sDisplayFieldName = FieldColumns[n].getDisplayFieldName(); - if (!(JavaTools.FieldInList(_DisplayFieldNames, sDisplayFieldName) > -1)) + if (JavaTools.FieldInList(_DisplayFieldNames, sDisplayFieldName) <= -1) { oRemainingFieldColumns.add(FieldColumns[n]); } diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index 57d1215a17b1..da043ee00220 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -373,7 +373,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme CurDBColumn = getDoc().DBColumnsVector.get(ColIndex); addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue); OldGroupFieldValues[ColIndex] = CurGroupValue; - breset = !(ColIndex == GroupFieldCount - 1); + breset = ColIndex != GroupFieldCount - 1; } } getRecordParser().getcurrentRecordData(DataVector); diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java index 80b5b9c3ae03..a67928adb23c 100644 --- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java @@ -343,7 +343,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator< public void toggleCommandListBox(String[] _NewItems) { - boolean bdoenable = !(QueryMetaData.getIncludedCommandNames(_NewItems).length >= CurDBMetaData.getMaxTablesInSelect()); + boolean bdoenable = QueryMetaData.getIncludedCommandNames(_NewItems).length < CurDBMetaData.getMaxTablesInSelect(); toggleCommandListBox(bdoenable); } diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java index 6ed54d9f2e4c..f7a6864e53e3 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -593,7 +593,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL } else { - enableNextButton(!(getCurrentStep() == nMaxStep)); + enableNextButton(getCurrentStep() != nMaxStep); } } } diff --git a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java index 1924573a432b..5ac4f0e56a6f 100644 --- a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java +++ b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java @@ -59,7 +59,7 @@ public class MethodInvocation { mMethod = method; mObject = obj; - mWithParam = !(paramClass == null); + mWithParam = paramClass != null; } /** 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 f6d6cf22a000..27f87f078171 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 @@ -164,7 +164,7 @@ public class Format implements Cloneable { public boolean getAttribute(int attribute) { if ((mask & attribute) == 0) return false; - return (!((attributes & attribute) == 0)); + return ((attributes & attribute) != 0); } /** @@ -431,4 +431,4 @@ public class Format implements Cloneable { return true; } -}
\ No newline at end of file +} |