summaryrefslogtreecommitdiff
path: root/odk
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-08-13 10:19:51 +0200
committerNoel Grandin <noel@peralex.com>2014-08-20 10:35:53 +0200
commit60f152caeee38579433a31dd3a98e91dc3d23ff6 (patch)
tree15ba69f938e09bb173ca7de2e1b21b62e740ea40 /odk
parent2922a967a1da5f9c0a07b5390906307d0ae6fe48 (diff)
java: avoid unnecessary comparisons in boolean expressions
i.e. stuff like "x == true" Change-Id: Ib82a4a30e736df392405332fa197b588482cffcf
Diffstat (limited to 'odk')
-rw-r--r--odk/examples/DevelopersGuide/Drawing/PresentationDemo.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java16
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java16
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java10
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java10
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Spell.java6
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminateListener.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminationTest.java4
-rw-r--r--odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java2
-rw-r--r--odk/source/com/sun/star/lib/loader/InstallationFinder.java2
14 files changed, 41 insertions, 41 deletions
diff --git a/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java b/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java
index 82f3cf3cd072..edef9c5445a3 100644
--- a/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java
@@ -211,7 +211,7 @@ public class PresentationDemo
// if the com.sun.star.presentation.DrawPage service is supported
XServiceInfo xInfo = UnoRuntime.queryInterface(
XServiceInfo.class, xPage );
- if ( xInfo.supportsService( "com.sun.star.presentation.DrawPage" ) == true )
+ if ( xInfo.supportsService( "com.sun.star.presentation.DrawPage" ) )
{
try
{
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java
index d21f8d36705b..1ef5ef3c90a6 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java
@@ -66,10 +66,10 @@ public class Desk
for(int i=0; i<lArguments.length; ++i)
{
lArguments[i] = lArguments[i].toLowerCase();
- if(lArguments[i].startsWith("mode=")==true)
+ if(lArguments[i].startsWith("mode="))
sMode = lArguments[i].substring(5);
else
- if(lArguments[i].startsWith("file=")==true)
+ if(lArguments[i].startsWith("file="))
sFile = lArguments[i].substring(5);
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
index 002c6442974f..e8d5221dc74e 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
@@ -167,7 +167,7 @@ public class DocumentView extends JFrame
JScrollPane paScroll = new JScrollPane();
paScroll.getViewport().add(paTest,null);
- if(ViewContainer.mbInplace==true)
+ if(ViewContainer.mbInplace)
{
// create view to show opened documents
// This special view is necessary for inplace mode only!
@@ -209,7 +209,7 @@ public class DocumentView extends JFrame
// create view frame (as a XFrame!) here
// Look for right view mode setted by user command line parameter.
// First try to get a new unambigous frame name from our global ViewContainer.
- if(ViewContainer.mbInplace==true)
+ if(ViewContainer.mbInplace)
{
// inplace document view can't be initialized without a visible parent window hierarchy!
// So make sure that we are visible in every case!
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
index bffa7321678a..49de6144f4d5 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
@@ -608,7 +608,7 @@ public class FunctionHelper
com.sun.star.util.XModifiable xModified = UnoRuntime.queryInterface(
com.sun.star.util.XModifiable.class,
xModel);
- if(xModified.isModified()==true)
+ if(xModified.isModified())
{
com.sun.star.frame.XStorable xStore = UnoRuntime.queryInterface(
com.sun.star.frame.XStorable.class,
@@ -667,13 +667,13 @@ public class FunctionHelper
{
// Find out possible filter name.
String sFilter = null;
- if(xInfo.supportsService("com.sun.star.text.TextDocument")==true)
+ if(xInfo.supportsService("com.sun.star.text.TextDocument"))
sFilter = "HTML (StarWriter)";
else
- if(xInfo.supportsService("com.sun.star.text.WebDocument")==true)
+ if(xInfo.supportsService("com.sun.star.text.WebDocument"))
sFilter = "HTML";
else
- if(xInfo.supportsService("com.sun.star.sheet.SpreadsheetDocument")==true)
+ if(xInfo.supportsService("com.sun.star.sheet.SpreadsheetDocument"))
sFilter = "HTML (StarCalc)";
// Check for existing state of this filter.
@@ -688,7 +688,7 @@ public class FunctionHelper
xCtx.getServiceManager().createInstanceWithContext(
"com.sun.star.document.FilterFactory", xCtx));
- if(xFilterContainer.hasByName(sFilter)==false)
+ if(!xFilterContainer.hasByName(sFilter))
sFilter=null;
}
@@ -890,7 +890,7 @@ public class FunctionHelper
aChooser = new JFileChooser(maLastDir);
// decide between file open/save dialog
- if( bOpen==true )
+ if( bOpen )
nDecision = aChooser.showOpenDialog(aParent);
else
nDecision = aChooser.showSaveDialog(aParent);
@@ -914,8 +914,8 @@ public class FunctionHelper
// => correct this problem first, otherwise office can't use these URL's
if(
( sFileURL !=null ) &&
- ( sFileURL.startsWith("file:/") ==true ) &&
- ( sFileURL.startsWith("file://")==false )
+ ( sFileURL.startsWith("file:/") ) &&
+ ( !sFileURL.startsWith("file://") )
)
{
StringBuffer sWorkBuffer = new StringBuffer(sFileURL);
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
index 77b48abb99e4..deaccb5db44f 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
@@ -128,7 +128,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
return;
if (m_xFrame==null)
return;
- if (m_bIsActionListener==true)
+ if (m_bIsActionListener)
return;
xFrame = m_xFrame;
}
@@ -423,7 +423,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
// intercept loading empty documents into new created frames
if(
(sTarget.compareTo ("_blank" ) == 0 ) &&
- (aURL.Complete.startsWith("private:factory") == true)
+ (aURL.Complete.startsWith("private:factory"))
)
{
System.out.println("intercept private:factory");
@@ -431,7 +431,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
}
// intercept opening the SaveAs dialog
- if (aURL.Complete.startsWith(".uno:SaveAs") == true)
+ if (aURL.Complete.startsWith(".uno:SaveAs"))
{
System.out.println("intercept SaveAs by returning null!");
return null;
@@ -439,8 +439,8 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
// intercept "File->Exit" inside the menu
if (
- (aURL.Complete.startsWith("slot:5300") == true) ||
- (aURL.Complete.startsWith(".uno:Quit") == true)
+ (aURL.Complete.startsWith("slot:5300")) ||
+ (aURL.Complete.startsWith(".uno:Quit"))
)
{
System.out.println("intercept File->Exit");
@@ -500,14 +500,14 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
}
if (
- (aURL.Complete.startsWith("slot:5300") == true) ||
- (aURL.Complete.startsWith(".uno:Quit") == true)
+ (aURL.Complete.startsWith("slot:5300")) ||
+ (aURL.Complete.startsWith(".uno:Quit"))
)
{
System.exit(0);
}
else
- if (aURL.Complete.startsWith("private:factory") == true)
+ if (aURL.Complete.startsWith("private:factory"))
{
// Create view frame for showing loaded documents on demand.
// The visible state is necessary for JNI functionality to get the HWND and plug office
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
index 317022d8190c..6fbf3c7afe72 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
@@ -135,7 +135,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener,
return;
if (m_xFrame==null)
return;
- if (m_bIsActionListener==true)
+ if (m_bIsActionListener)
return;
xFrame = m_xFrame;
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
index fdc82ea24e6d..13fad3c02d21 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
@@ -92,7 +92,7 @@ public class ViewContainer extends Thread
{
synchronized(mlViews)
{
- if(mlViews.contains(aView)==false)
+ if(!mlViews.contains(aView))
mlViews.add(aView);
}
}
@@ -115,7 +115,7 @@ public class ViewContainer extends Thread
int nViewCount = 0;
synchronized(mlViews)
{
- if(mlViews.contains(aView)==true)
+ if(mlViews.contains(aView))
mlViews.remove(aView);
nViewCount = mlViews.size();
@@ -130,10 +130,10 @@ public class ViewContainer extends Thread
synchronized(mlListener)
{
bShutdownView = mlListener.contains(aView);
- if (bShutdownView==true)
+ if (bShutdownView)
mlListener.remove(aView);
}
- if (bShutdownView==true)
+ if (bShutdownView)
((IShutdownListener)aView).shutdown();
// We use a system.exit() to finish the whole application.
@@ -150,7 +150,7 @@ public class ViewContainer extends Thread
{
bNecessary = ! mbShutdownActive;
}
- if (bNecessary==true)
+ if (bNecessary)
{
System.out.println("call exit(0)!");
System.exit(0);
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java
index f12b2cf2d1d8..c4816fa3a9d9 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java
@@ -344,7 +344,7 @@ public class AsciiReplaceFilter
measure("options analyzed");
- if (aOptions.isValid()==false)
+ if (!aOptions.isValid())
return false;
// start real filtering
@@ -503,7 +503,7 @@ public class AsciiReplaceFilter
xRefresh.refresh();
// If we created used stream - we must close it too.
- if (aOptions.m_bStreamOwner==true)
+ if (aOptions.m_bStreamOwner)
{
aOptions.m_xInput.closeInput();
measure("stream close");
@@ -577,7 +577,7 @@ public class AsciiReplaceFilter
measure("written to file");
// If we created used stream - we must close it too.
- if (aOptions.m_bStreamOwner==true)
+ if (aOptions.m_bStreamOwner)
{
aOptions.m_xOutput.closeOutput();
measure("stream close");
@@ -617,9 +617,9 @@ public class AsciiReplaceFilter
// convert buffer into return format [string]
// and convert to lower or upper case if required.
String sResult = rBuffer.toString();
- if (aOptions.m_bCaseChange==true)
+ if (aOptions.m_bCaseChange)
{
- if (aOptions.m_bLower==true)
+ if (aOptions.m_bLower)
sResult = sResult.toLowerCase();
else
sResult = sResult.toUpperCase();
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java
index ce221117201a..dbefb717b0f4 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java
@@ -208,7 +208,7 @@ public class FilterOptions
m_xMCF.createInstanceWithContext("com.sun.star.ucb.SimpleFileAccess", m_Ctx));
if (xHelper!=null)
{
- if (bImport==true)
+ if (bImport)
m_xInput = xHelper.openFileRead(m_sURL);
else
m_xOutput = xHelper.openFileWrite(m_sURL);
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Spell.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Spell.java
index 16d93269ad97..fb1e4a6d3782 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Spell.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Spell.java
@@ -74,17 +74,17 @@ public class PropChgHelper_Spell extends PropChgHelper
}
else if (aEvt.PropertyName.equals( "IsSpellUpperCase" ))
{
- bSCWA = false == bVal; // FALSE->TRUE change?
+ bSCWA = !bVal; // FALSE->TRUE change?
bSWWA = !bSCWA; // TRUE->FALSE change?
}
else if (aEvt.PropertyName.equals( "IsSpellWithDigits" ))
{
- bSCWA = false == bVal; // FALSE->TRUE change?
+ bSCWA = !bVal; // FALSE->TRUE change?
bSWWA = !bSCWA; // TRUE->FALSE change?
}
else if (aEvt.PropertyName.equals( "IsSpellCapitalization" ))
{
- bSCWA = false == bVal; // FALSE->TRUE change?
+ bSCWA = !bVal; // FALSE->TRUE change?
bSWWA = !bSCWA; // TRUE->FALSE change?
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminateListener.java b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminateListener.java
index ceded40f2e61..8d8d698a5c89 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminateListener.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminateListener.java
@@ -45,7 +45,7 @@ public class TerminateListener implements XTerminateListener {
throws TerminationVetoException {
// test if we can terminate now
- if (TerminationTest.isAtWork() == true) {
+ if (TerminationTest.isAtWork()) {
System.out.println("Terminate while we are at work? You can't mean it serious ;-)!");
throw new TerminationVetoException();
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminationTest.java b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminationTest.java
index a01fb242c9de..1dc59d318af1 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminationTest.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminationTest.java
@@ -67,7 +67,7 @@ public class TerminationTest extends java.lang.Object {
// try to terminate while we are at work
boolean terminated = xDesktop.terminate();
System.out.println("The Office " +
- (terminated == true ?
+ (terminated ?
"has been terminated" :
"is still running, we are at work"));
@@ -76,7 +76,7 @@ public class TerminationTest extends java.lang.Object {
// once more: try to terminate
terminated = xDesktop.terminate();
System.out.println("The Office " +
- (terminated == true ?
+ (terminated ?
"has been terminated" :
"is still running. Someone else prevents termination, " +
"e.g. the quickstarter"));
diff --git a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java
index a289359e51b6..9b5962ebf65b 100644
--- a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java
+++ b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java
@@ -279,7 +279,7 @@ class ScriptSelectorPanel extends JPanel {
private void initNodes(XBrowseNode parent, DefaultMutableTreeNode top) {
- if ( parent == null || parent.hasChildNodes() == false )
+ if ( parent == null || !parent.hasChildNodes() )
{
return;
}
diff --git a/odk/source/com/sun/star/lib/loader/InstallationFinder.java b/odk/source/com/sun/star/lib/loader/InstallationFinder.java
index dcf80302105a..343ca54200f2 100644
--- a/odk/source/com/sun/star/lib/loader/InstallationFinder.java
+++ b/odk/source/com/sun/star/lib/loader/InstallationFinder.java
@@ -391,7 +391,7 @@ final class InstallationFinder {
new FileInputStream( fSVersion ), "UTF-8" ) );
String line = null;
while ( ( line = br.readLine() ) != null &&
- ( line.equals( VERSIONS ) ) != true ) {
+ !line.equals( VERSIONS ) ) {
// read lines until [Versions] is found
}
while ( ( line = br.readLine() ) != null &&