summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorRobert Antoni Buj i Gelonch <robert.buj@gmail.com>2014-09-30 13:05:54 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-10-30 14:24:48 +0000
commit1e48bfafdd25d595a2265a5bc66230f3681e96b5 (patch)
treeca65cb8fb416b94a7b4e96bf331e330581ae0022 /forms
parent0641dd420956d4c3777c17dd0c0a563fb222e265 (diff)
forms: The if statement is redundant
Change-Id: I1d339ea6052e648acf4405d2d40795c82ee043ca Reviewed-on: https://gerrit.libreoffice.org/11713 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'forms')
-rw-r--r--forms/qa/integration/forms/BooleanValidator.java4
-rw-r--r--forms/qa/integration/forms/DateValidator.java4
-rw-r--r--forms/qa/integration/forms/FormComponent.java20
-rw-r--r--forms/qa/integration/forms/ListSelectionValidator.java4
-rw-r--r--forms/qa/integration/forms/NumericValidator.java4
-rw-r--r--forms/qa/integration/forms/TextValidator.java11
-rw-r--r--forms/qa/integration/forms/TimeValidator.java4
7 files changed, 13 insertions, 38 deletions
diff --git a/forms/qa/integration/forms/BooleanValidator.java b/forms/qa/integration/forms/BooleanValidator.java
index 730c45f65eb9..8201fe99f5ae 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 055e77952314..255ec6f6f6f3 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 89b8f91b83c7..eb7467a55e59 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 ce94a1ed7a86..164110d30f82 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 25b3ea88e23b..06370cfb30e6 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 d60c1022fa8b..0ed59dd41cfa 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 673cf6723749..8ff19464ab3f 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 )
{