forms/qa/integration/forms/BooleanValidator.java | 4 --- forms/qa/integration/forms/DateValidator.java | 4 --- forms/qa/integration/forms/FormComponent.java | 20 ++++------------- forms/qa/integration/forms/ListSelectionValidator.java | 4 --- forms/qa/integration/forms/NumericValidator.java | 4 --- forms/qa/integration/forms/TextValidator.java | 11 ++------- forms/qa/integration/forms/TimeValidator.java | 4 --- 7 files changed, 13 insertions(+), 38 deletions(-)
New commits: commit 1e48bfafdd25d595a2265a5bc66230f3681e96b5 Author: Robert Antoni Buj i Gelonch <robert....@gmail.com> Date: Tue Sep 30 13:05:54 2014 +0200 forms: The if statement is redundant Change-Id: I1d339ea6052e648acf4405d2d40795c82ee043ca Reviewed-on: https://gerrit.libreoffice.org/11713 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/forms/qa/integration/forms/BooleanValidator.java b/forms/qa/integration/forms/BooleanValidator.java index 730c45f..8201fe9 100644 --- a/forms/qa/integration/forms/BooleanValidator.java +++ b/forms/qa/integration/forms/BooleanValidator.java @@ -61,9 +61,7 @@ public class BooleanValidator extends integration.forms.ControlValidator return false; boolean value = ((Boolean)Value).booleanValue(); - if ( m_preventChecked && ( value ) ) - return false; - return true; + return !(m_preventChecked && ( value )); } catch( java.lang.Exception e ) { diff --git a/forms/qa/integration/forms/DateValidator.java b/forms/qa/integration/forms/DateValidator.java index 055e779..255ec6f 100644 --- a/forms/qa/integration/forms/DateValidator.java +++ b/forms/qa/integration/forms/DateValidator.java @@ -54,9 +54,7 @@ public class DateValidator extends integration.forms.ControlValidator if ( isDedicatedInvalidDate( dateValue ) ) return false; - if ( !isNextMonthsDate( dateValue ) ) - return false; - return true; + return isNextMonthsDate( dateValue ); } catch( java.lang.Exception e ) { diff --git a/forms/qa/integration/forms/FormComponent.java b/forms/qa/integration/forms/FormComponent.java index 89b8f91..eb7467a 100644 --- a/forms/qa/integration/forms/FormComponent.java +++ b/forms/qa/integration/forms/FormComponent.java @@ -103,9 +103,7 @@ public class FormComponent /* ------------------------------------------------------------------ */ public String[] getElementNames() { - if ( m_nameAccess != null ) - return m_nameAccess.getElementNames(); - return new String[]{}; + return ( m_nameAccess != null ) ? m_nameAccess.getElementNames() : new String[]{}; } @@ -113,9 +111,7 @@ public class FormComponent /* ------------------------------------------------------------------ */ public int getCount() { - if ( m_indexAccess != null ) - return m_indexAccess.getCount(); - return 0; + return ( m_indexAccess != null ) ? m_indexAccess.getCount() : 0; } /* ------------------------------------------------------------------ */ @@ -149,17 +145,13 @@ public class FormComponent /* ------------------------------------------------------------------ */ public FormComponent getParent() { - if ( m_child != null ) - return new FormComponent( m_child.getParent() ); - return new FormComponent(); + return ( m_child != null ) ? new FormComponent( m_child.getParent() ) : new FormComponent(); } /* ------------------------------------------------------------------ */ public String getName() { - if ( m_named != null ) - return m_named.getName(); - return ""; + return ( m_named != null ) ? m_named.getName() : ""; } /* ------------------------------------------------------------------ */ @@ -167,8 +159,6 @@ public class FormComponent { XServiceInfo si = UnoRuntime.queryInterface( XServiceInfo.class, m_component ); - if ( si != null ) - return si.getImplementationName(); - return ""; + return ( si != null ) ? si.getImplementationName() : ""; } } diff --git a/forms/qa/integration/forms/ListSelectionValidator.java b/forms/qa/integration/forms/ListSelectionValidator.java index ce94a1e..164110d 100644 --- a/forms/qa/integration/forms/ListSelectionValidator.java +++ b/forms/qa/integration/forms/ListSelectionValidator.java @@ -40,9 +40,7 @@ public class ListSelectionValidator extends integration.forms.ControlValidator try { short[] selectionIndexes = (short[])Value; - if ( selectionIndexes.length > 2 ) - return false; - return true; + return selectionIndexes.length <= 2; } catch( java.lang.Exception e ) { diff --git a/forms/qa/integration/forms/NumericValidator.java b/forms/qa/integration/forms/NumericValidator.java index 25b3ea8..06370cf 100644 --- a/forms/qa/integration/forms/NumericValidator.java +++ b/forms/qa/integration/forms/NumericValidator.java @@ -48,9 +48,7 @@ public class NumericValidator extends integration.forms.ControlValidator return false; if ( !isProperRange( value ) ) return false; - if ( !isProperDigitCount( value ) ) - return false; - return true; + return isProperDigitCount( value ); } catch( java.lang.Exception e ) { diff --git a/forms/qa/integration/forms/TextValidator.java b/forms/qa/integration/forms/TextValidator.java index d60c102..0ed59dd 100644 --- a/forms/qa/integration/forms/TextValidator.java +++ b/forms/qa/integration/forms/TextValidator.java @@ -44,9 +44,7 @@ public class TextValidator extends integration.forms.ControlValidator String value = (String)Value; if ( containsZs( value ) ) return false; - if ( !isProperChunks( value ) ) - return false; - return true; + return isProperChunks( value ); } catch( java.lang.Exception e ) { @@ -61,10 +59,7 @@ public class TextValidator extends integration.forms.ControlValidator private boolean containsZs( String value ) { - if ( ( value.indexOf( 'Z' ) != -1 ) - || ( value.indexOf( 'z' ) != -1 ) - ) - return true; - return false; + return ( value.indexOf( 'Z' ) != -1 ) + || ( value.indexOf( 'z' ) != -1 ); } } diff --git a/forms/qa/integration/forms/TimeValidator.java b/forms/qa/integration/forms/TimeValidator.java index 673cf67..8ff1946 100644 --- a/forms/qa/integration/forms/TimeValidator.java +++ b/forms/qa/integration/forms/TimeValidator.java @@ -52,9 +52,7 @@ public class TimeValidator extends integration.forms.ControlValidator com.sun.star.util.Time.class, Value); if ( isInvalidTime( timeValue ) ) return false; - if ( !isFullHour( timeValue ) ) - return false; - return true; + return isFullHour( timeValue ); } catch( java.lang.Exception e ) {
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits