Kaydet (Commit) a795c366 authored tarafından rbuj's avatar rbuj Kaydeden (comit) Thomas Arnhold

scripting: the if statement is redundant

Change-Id: I7e61d740d6f58afbcdad630deb0de0ef548efcfb
Reviewed-on: https://gerrit.libreoffice.org/11288Reviewed-by: 's avatarThomas Arnhold <thomas@arnhold.org>
Tested-by: 's avatarThomas Arnhold <thomas@arnhold.org>
üst 652b8076
...@@ -37,12 +37,7 @@ public class PkgProviderBrowseNode extends ProviderBrowseNode ...@@ -37,12 +37,7 @@ public class PkgProviderBrowseNode extends ProviderBrowseNode
@Override @Override
public String getName() { public String getName() {
String name = "Unknown"; return (container != null) ? container.getName() : "Unknown";
if ( container != null )
{
name = container.getName();
}
return name;
} }
} }
...@@ -140,11 +140,7 @@ public class Parcel implements XNameContainer ...@@ -140,11 +140,7 @@ public class Parcel implements XNameContainer
public boolean hasElements() public boolean hasElements()
{ {
if ( m_descriptor != null && m_descriptor.getScriptEntries().length > 0 ) return m_descriptor != null && m_descriptor.getScriptEntries().length > 0;
{
return true;
}
return false;
} }
public void replaceByName( String aName, java.lang.Object aElement ) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.container.NoSuchElementException, com.sun.star.lang.WrappedTargetException public void replaceByName( String aName, java.lang.Object aElement ) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.container.NoSuchElementException, com.sun.star.lang.WrappedTargetException
......
...@@ -362,11 +362,7 @@ public class ParcelContainer implements XNameAccess ...@@ -362,11 +362,7 @@ public class ParcelContainer implements XNameAccess
} }
public boolean hasElements() public boolean hasElements()
{ {
if ( parcels == null || parcels.isEmpty() ) return !(parcels == null || parcels.isEmpty());
{
return false;
}
return true;
} }
private void loadParcels() throws com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException private void loadParcels() throws com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException
......
...@@ -76,13 +76,11 @@ public class ScriptEntry implements Cloneable { ...@@ -76,13 +76,11 @@ public class ScriptEntry implements Cloneable {
} }
public boolean equals(ScriptEntry other) { public boolean equals(ScriptEntry other) {
if (language.equals(other.getLanguage()) && return language.equals(other.getLanguage()) &&
languagename.equals(other.getLanguageName()) && languagename.equals(other.getLanguageName()) &&
logicalname.equals(other.getLogicalName()) && logicalname.equals(other.getLogicalName()) &&
languagedepprops.equals(other.getLanguageProperties()) && languagedepprops.equals(other.getLanguageProperties()) &&
location.equals(other.getLocation())) location.equals(other.getLocation());
return true;
return false;
} }
public Map<String,String> getLanguageProperties() public Map<String,String> getLanguageProperties()
......
...@@ -65,39 +65,17 @@ public class ScriptMetaData extends ScriptEntry { ...@@ -65,39 +65,17 @@ public class ScriptMetaData extends ScriptEntry {
{ {
return hasSource; return hasSource;
} }
public String getSource()
{
if ( source !=null && hasSource ) public String getSource() {
{ return ( source !=null && hasSource ) ? source : null;
return source;
}
else
{
return null;
}
}
public byte[] getSourceBytes()
{
if ( source !=null && hasSource )
{
return source.getBytes();
}
else
{
return null;
} }
public byte[] getSourceBytes() {
return ( source !=null && hasSource ) ? source.getBytes() : null;
} }
public boolean equals(ScriptMetaData other) { public boolean equals(ScriptMetaData other) {
if (super.equals(other) && return super.equals(other) && hasSource == other.hasSource();
hasSource == other.hasSource() )
{
return true;
}
return false;
} }
public String getScriptFullURL() public String getScriptFullURL()
......
...@@ -68,14 +68,8 @@ public class UnoPkgContainer extends ParcelContainer ...@@ -68,14 +68,8 @@ public class UnoPkgContainer extends ParcelContainer
return result; return result;
} }
public boolean hasRegisteredUnoPkgContainer( String url ) public boolean hasRegisteredUnoPkgContainer( String url ) {
{ return getRegisteredUnoPkgContainer( url ) != null;
boolean result = false;
if ( getRegisteredUnoPkgContainer( url ) != null )
{
result = true;
}
return result;
} }
private void registerPackageContainer( String url, ParcelContainer c ) private void registerPackageContainer( String url, ParcelContainer c )
......
...@@ -557,14 +557,8 @@ public abstract class ScriptProvider ...@@ -557,14 +557,8 @@ public abstract class ScriptProvider
// Performs the getRegStatus functionality for the PkgMgr // Performs the getRegStatus functionality for the PkgMgr
public boolean hasByName( String aName ) public boolean hasByName( String aName ) {
{ return ((UnoPkgContainer)m_container).hasRegisteredUnoPkgContainer( aName );
boolean result = false;
if ( ((UnoPkgContainer)m_container).hasRegisteredUnoPkgContainer( aName ) )
{
result = true;
}
return result;
} }
public com.sun.star.uno.Type getElementType() public com.sun.star.uno.Type getElementType()
......
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