Skip to content

Commit

Permalink
Bug 1081593: Clean up some ternary operators. r=rnewmam
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisKitching committed Oct 12, 2014
1 parent 9bd06de commit 7105037
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected void onHandleIntent(Intent intent) {

// The same intent can be handled by multiple methods so do not short-circuit evaluate.
boolean handled = attemptHandleIntentForUpload(intent);
handled = attemptHandleIntentForPrune(intent) ? true : handled;
handled = attemptHandleIntentForPrune(intent) || handled;

if (!handled) {
Logger.warn(LOG_TAG, "Unhandled intent with action " + intent.getAction() + ".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void tick(final long time) {
try {
try {
boolean pruned = attemptPruneBySize(time);
pruned = attemptExpiration(time) ? true : pruned;
pruned = attemptExpiration(time) || pruned;
// We only need to cleanup after a large pruning.
if (pruned) {
attemptStorageCleanup(time);
Expand Down
2 changes: 1 addition & 1 deletion mobile/android/base/home/PanelViewAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private void bindView(View view, int position) {
}

private boolean isShowingBack() {
return (filterManager != null ? filterManager.canGoBack() : false);
return filterManager != null && filterManager.canGoBack();
}

private final Cursor getCursor(int position) {
Expand Down
8 changes: 5 additions & 3 deletions mobile/android/base/widget/CheckableLinearLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ public CheckableLinearLayout(Context context, AttributeSet attrs) {

@Override
public boolean isChecked() {
return mCheckBox != null ? mCheckBox.isChecked() : false;
return mCheckBox != null && mCheckBox.isChecked();
}

@Override
public void setChecked(boolean isChecked) {
if (mCheckBox != null)
if (mCheckBox != null) {
mCheckBox.setChecked(isChecked);
}
}

@Override
public void toggle() {
if (mCheckBox != null)
if (mCheckBox != null) {
mCheckBox.toggle();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,6 @@ public void checkPrefs() {
}

public boolean isGeofenced() {
return (mGPSScanner == null)? false : mGPSScanner.isGeofenced();
return (mGPSScanner != null) && mGPSScanner.isGeofenced();
}
}

0 comments on commit 7105037

Please sign in to comment.