Kaydet (Commit) 1e48bfaf authored tarafından Robert Antoni Buj i Gelonch's avatar Robert Antoni Buj i Gelonch Kaydeden (comit) Caolán McNamara

forms: The if statement is redundant

Change-Id: I1d339ea6052e648acf4405d2d40795c82ee043ca
Reviewed-on: https://gerrit.libreoffice.org/11713Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 0641dd42
...@@ -61,9 +61,7 @@ public class BooleanValidator extends integration.forms.ControlValidator ...@@ -61,9 +61,7 @@ public class BooleanValidator extends integration.forms.ControlValidator
return false; return false;
boolean value = ((Boolean)Value).booleanValue(); boolean value = ((Boolean)Value).booleanValue();
if ( m_preventChecked && ( value ) ) return !(m_preventChecked && ( value ));
return false;
return true;
} }
catch( java.lang.Exception e ) catch( java.lang.Exception e )
{ {
......
...@@ -54,9 +54,7 @@ public class DateValidator extends integration.forms.ControlValidator ...@@ -54,9 +54,7 @@ public class DateValidator extends integration.forms.ControlValidator
if ( isDedicatedInvalidDate( dateValue ) ) if ( isDedicatedInvalidDate( dateValue ) )
return false; return false;
if ( !isNextMonthsDate( dateValue ) ) return isNextMonthsDate( dateValue );
return false;
return true;
} }
catch( java.lang.Exception e ) catch( java.lang.Exception e )
{ {
......
...@@ -103,9 +103,7 @@ public class FormComponent ...@@ -103,9 +103,7 @@ public class FormComponent
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
public String[] getElementNames() public String[] getElementNames()
{ {
if ( m_nameAccess != null ) return ( m_nameAccess != null ) ? m_nameAccess.getElementNames() : new String[]{};
return m_nameAccess.getElementNames();
return new String[]{};
} }
...@@ -113,9 +111,7 @@ public class FormComponent ...@@ -113,9 +111,7 @@ public class FormComponent
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
public int getCount() public int getCount()
{ {
if ( m_indexAccess != null ) return ( m_indexAccess != null ) ? m_indexAccess.getCount() : 0;
return m_indexAccess.getCount();
return 0;
} }
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
...@@ -149,17 +145,13 @@ public class FormComponent ...@@ -149,17 +145,13 @@ public class FormComponent
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
public FormComponent getParent() public FormComponent getParent()
{ {
if ( m_child != null ) return ( m_child != null ) ? new FormComponent( m_child.getParent() ) : new FormComponent();
return new FormComponent( m_child.getParent() );
return new FormComponent();
} }
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
public String getName() public String getName()
{ {
if ( m_named != null ) return ( m_named != null ) ? m_named.getName() : "";
return m_named.getName();
return "";
} }
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
...@@ -167,8 +159,6 @@ public class FormComponent ...@@ -167,8 +159,6 @@ public class FormComponent
{ {
XServiceInfo si = UnoRuntime.queryInterface( XServiceInfo si = UnoRuntime.queryInterface(
XServiceInfo.class, m_component ); XServiceInfo.class, m_component );
if ( si != null ) return ( si != null ) ? si.getImplementationName() : "";
return si.getImplementationName();
return "";
} }
} }
...@@ -40,9 +40,7 @@ public class ListSelectionValidator extends integration.forms.ControlValidator ...@@ -40,9 +40,7 @@ public class ListSelectionValidator extends integration.forms.ControlValidator
try try
{ {
short[] selectionIndexes = (short[])Value; short[] selectionIndexes = (short[])Value;
if ( selectionIndexes.length > 2 ) return selectionIndexes.length <= 2;
return false;
return true;
} }
catch( java.lang.Exception e ) catch( java.lang.Exception e )
{ {
......
...@@ -48,9 +48,7 @@ public class NumericValidator extends integration.forms.ControlValidator ...@@ -48,9 +48,7 @@ public class NumericValidator extends integration.forms.ControlValidator
return false; return false;
if ( !isProperRange( value ) ) if ( !isProperRange( value ) )
return false; return false;
if ( !isProperDigitCount( value ) ) return isProperDigitCount( value );
return false;
return true;
} }
catch( java.lang.Exception e ) catch( java.lang.Exception e )
{ {
......
...@@ -44,9 +44,7 @@ public class TextValidator extends integration.forms.ControlValidator ...@@ -44,9 +44,7 @@ public class TextValidator extends integration.forms.ControlValidator
String value = (String)Value; String value = (String)Value;
if ( containsZs( value ) ) if ( containsZs( value ) )
return false; return false;
if ( !isProperChunks( value ) ) return isProperChunks( value );
return false;
return true;
} }
catch( java.lang.Exception e ) catch( java.lang.Exception e )
{ {
...@@ -61,10 +59,7 @@ public class TextValidator extends integration.forms.ControlValidator ...@@ -61,10 +59,7 @@ public class TextValidator extends integration.forms.ControlValidator
private boolean containsZs( String value ) private boolean containsZs( String value )
{ {
if ( ( value.indexOf( 'Z' ) != -1 ) return ( value.indexOf( 'Z' ) != -1 )
|| ( value.indexOf( 'z' ) != -1 ) || ( value.indexOf( 'z' ) != -1 );
)
return true;
return false;
} }
} }
...@@ -52,9 +52,7 @@ public class TimeValidator extends integration.forms.ControlValidator ...@@ -52,9 +52,7 @@ public class TimeValidator extends integration.forms.ControlValidator
com.sun.star.util.Time.class, Value); com.sun.star.util.Time.class, Value);
if ( isInvalidTime( timeValue ) ) if ( isInvalidTime( timeValue ) )
return false; return false;
if ( !isFullHour( timeValue ) ) return isFullHour( timeValue );
return false;
return true;
} }
catch( java.lang.Exception e ) catch( java.lang.Exception e )
{ {
......
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