Kaydet (Commit) dc53e302 authored tarafından Noel Grandin's avatar Noel Grandin

java: simplify conditions involving logical negation

Change-Id: Ib45e58273e650ef9a31dbdb5f71e995a5976f50e
üst 726fc58d
......@@ -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);
......
......@@ -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(";")) )
{
......
......@@ -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="))
......
......@@ -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(";")) )
{
......
......@@ -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="))
......
......@@ -671,7 +671,7 @@ public class OfficeProvider implements AppProvider
if (sep.equalsIgnoreCase("\\"))
{
if (!(idx2 < 0))
if (idx2 >= 0)
{
sysDir = sysDir.substring(1);
}
......
......@@ -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) ;
}
......
......@@ -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);
......
......@@ -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 );
......
......@@ -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);
}
......
......@@ -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)) {
......
......@@ -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]);
}
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -593,7 +593,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
}
else
{
enableNextButton(!(getCurrentStep() == nMaxStep));
enableNextButton(getCurrentStep() != nMaxStep);
}
}
}
......
......@@ -59,7 +59,7 @@ public class MethodInvocation
{
mMethod = method;
mObject = obj;
mWithParam = !(paramClass == null);
mWithParam = paramClass != null;
}
/**
......
......@@ -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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment