Skip to content

Commit

Permalink
Simplify a few boolean expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
sschuberth authored and emmanue1 committed Jul 7, 2015
1 parent bd0e9a5 commit 6a361ee
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class UISingleInstancePreferencesProvider extends JPanel implements PreferencesP
public void init(Color errorBackgroundColor) {}

public boolean isActivated() {
System.getProperty('os.name').toLowerCase().contains('mac os') == false
!System.getProperty('os.name').toLowerCase().contains('mac os')
}

void loadPreferences(Map<String, String> preferences) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class UITabsPreferencesProvider extends JPanel implements PreferencesPanel {
public void init(Color errorBackgroundColor) {}

public boolean isActivated() {
System.getProperty('os.name').toLowerCase().contains('mac os') == false
!System.getProperty('os.name').toLowerCase().contains('mac os')
}

void loadPreferences(Map<String, String> preferences) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DirectoryTreeNodeFactoryProvider extends AbstractTreeNodeFactoryProvider {
// Aggregate directory names
while (entries.size() == 1) {
Entry child = entries[0]
if ((child.isDirectory() == false) || (api.getTreeNodeFactory(child) != this) || (entry.container != child.container)) break
if (!child.isDirectory() || api.getTreeNodeFactory(child) != this || entry.container != child.container) break
entry = child
entries = entry.children
}
Expand Down Expand Up @@ -77,7 +77,9 @@ class DirectoryTreeNodeFactoryProvider extends AbstractTreeNodeFactoryProvider {

while (entries.size() == 1) {
Entry child = entries[0]
if ((child.isDirectory() == false) || (api.getTreeNodeFactory(child) != this)) break
if (!child.isDirectory() || api.getTreeNodeFactory(child) != this) {
break
}
entries = child.children
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PackageTreeNodeFactoryProvider extends DirectoryTreeNodeFactoryProvider {
// Aggregate directory names
while (entries.size() == 1) {
Container.Entry child = entries[0]
if ((child.isDirectory() == false) || (api.getTreeNodeFactory(child) != this) || (entry.container != child.container)) break
if (!child.isDirectory() || api.getTreeNodeFactory(child) != this || entry.container != child.container) break
entry = child
entries = entry.children
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class AbstractTextPage extends JPanel implements LineNumberNavigable, ContentSea
foldsExpanded |= fm.ensureOffsetNotInClosedFold(end)
}

if (foldsExpanded == false) {
if (!foldsExpanded) {
try {
Rectangle r = textArea.modelToView(start)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void startOfAnnotationName() {}
public void endOfAnnotationName() {}

public void startOfOptionalPrefix() {
if (isShowPrefixThis() == false)
if (!isShowPrefixThis())
this.display = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public void startOfAnnotationName() {}
public void endOfAnnotationName() {}

public void startOfOptionalPrefix() {
if (this.preferences.isShowPrefixThis() == false)
if (!this.preferences.isShowPrefixThis())
this.display = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static boolean matchMethodDescriptors(String d1, String d2) {

// Check parameter descriptors
while (cb2.get() != ')') {
if (matchDescriptors(cb1, cb2) == false)
if (!matchDescriptors(cb1, cb2))
return false;
}

Expand Down Expand Up @@ -138,7 +138,7 @@ public boolean compareTypeWith(CharBuffer other) {
int otherStart = other.offset;

// Search ';'
if ((searchEndOfType() == false) || (other.searchEndOfType() == false))
if (!searchEndOfType() || !other.searchEndOfType())
return false;

int current = offset - 1;
Expand Down

0 comments on commit 6a361ee

Please sign in to comment.