Skip to content

Commit

Permalink
Clean up redundant boolean comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
arcivanov committed Apr 18, 2015
1 parent 62d9861 commit 04fd626
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
Expand Up @@ -100,7 +100,7 @@ public String toExternalForm() {

public URL getArtifactURL(URL baseURL) {
String base = baseURL.toExternalForm();
if (base.endsWith("/") == false)
if (!base.endsWith("/"))
base += "/";
String urlstr = base + getArtifactPath();
try {
Expand Down
Expand Up @@ -121,7 +121,7 @@ private boolean transistiveInUse(AbstractBundleWiring wiring, boolean checkCurre
@Override
public List<BundleCapability> getCapabilities(String namespace) {
// If this bundle wiring is not in use, null will be returned
if (isInUse() == false) {
if (!isInUse()) {
return null;
}
List<BundleCapability> result = new ArrayList<BundleCapability>();
Expand All @@ -134,7 +134,7 @@ public List<BundleCapability> getCapabilities(String namespace) {
@Override
public List<BundleRequirement> getRequirements(String namespace) {
// If this bundle wiring is not in use, null will be returned
if (isInUse() == false) {
if (!isInUse()) {
return null;
}
List<BundleRequirement> result = new ArrayList<BundleRequirement>();
Expand All @@ -147,7 +147,7 @@ public List<BundleRequirement> getRequirements(String namespace) {
@Override
public List<BundleWire> getProvidedWires(String namespace) {
// If this bundle wiring is not in use, null will be returned
if (isInUse() == false) {
if (!isInUse()) {
return null;
}
List<BundleWire> providedWires = new ArrayList<BundleWire>();
Expand All @@ -160,7 +160,7 @@ public List<BundleWire> getProvidedWires(String namespace) {
@Override
public List<BundleWire> getRequiredWires(String namespace) {
// If this bundle wiring is not in use, null will be returned
if (isInUse() == false) {
if (!isInUse()) {
return null;
}
List<BundleWire> requiredWires = new ArrayList<BundleWire>();
Expand All @@ -183,7 +183,7 @@ public XBundleRevision getResource() {
@Override
public ClassLoader getClassLoader() {
// If this bundle wiring is not in use, null will be returned
if (isInUse() == false) {
if (!isInUse()) {
return null;
}
XBundleRevision brev = getRevision();
Expand All @@ -193,7 +193,7 @@ public ClassLoader getClassLoader() {
@Override
public List<URL> findEntries(String path, String filePattern, int options) {
// If this bundle wiring is not in use, null will be returned
if (isInUse() == false) {
if (!isInUse()) {
return null;
}
List<URL> result = new ArrayList<URL>();
Expand All @@ -217,7 +217,7 @@ public Collection<String> listResources(String startPath, String filePattern, in
filePattern = "*";

// If this bundle wiring is not in use, null will be returned
if (isInUse() == false || getRevision().isFragment()) {
if (!isInUse() || getRevision().isFragment()) {
return null;
}

Expand Down
Expand Up @@ -112,7 +112,7 @@ private boolean isMutable() {

@Override
public void validate() {
if (valid == false) {
if (!valid) {
if (AbstractResource.identityNamespaces.contains(getNamespace())) {
version = getVersion(this, CAPABILITY_VERSION_ATTRIBUTE);
namespaceValue = (String) getAttribute(getNamespace());
Expand Down
Expand Up @@ -106,7 +106,7 @@ static String getNamespaceValue(Requirement req, StringBuffer operator) {

@Override
public void validate() {
if (valid == false) {
if (!valid) {
Map<String, Object> atts = attributes.getAttributes();
Map<String, String> dirs = directives.getDirectives();

Expand Down Expand Up @@ -197,7 +197,7 @@ private boolean isMutable() {
}

private void assertImmutable() {
if (isMutable() == true)
if (isMutable())
throw MESSAGES.illegalStateInvalidAccessToMutableResource();
}

Expand All @@ -222,7 +222,7 @@ public boolean matches(Capability cap) {
// The requirement matches the capability if their namespaces match and the filter is absent or matches the attributes.
boolean matches = namespace.equals(cap.getNamespace()) && matchFilter(cap);

if (matches == true) {
if (matches) {
if (BUNDLE_NAMESPACE.equals(getNamespace())) {
matches = matchesResourceRequirement(cap);
} else if (HOST_NAMESPACE.equals(getNamespace())) {
Expand Down
Expand Up @@ -128,7 +128,7 @@ private void appendOptionalFragments(XEnvironment env, Collection<? extends Reso
}
}
}
if (fragments.isEmpty() == false) {
if (!fragments.isEmpty()) {
LOGGER.debugf("Adding attachable fragments: %s", fragments);
optres.addAll(fragments);
}
Expand Down
Expand Up @@ -126,12 +126,12 @@ public boolean isAbstract() {
}

public void ensureImmutable() {
if (isMutable() == true)
if (isMutable())
throw MESSAGES.illegalStateInvalidAccessToMutableResource();
}

public void ensureMutable() {
if (isMutable() == false)
if (!isMutable())
throw MESSAGES.illegalStateInvalidAccessToImmutableResource();
}

Expand Down
Expand Up @@ -215,7 +215,7 @@ public XResourceBuilder<T> loadFrom(OSGiMetaData metadata) throws ResourceBuilde

// Required Bundles
List<ParameterizedAttribute> requireBundles = metadata.getRequireBundles();
if (requireBundles != null && requireBundles.isEmpty() == false) {
if (requireBundles != null && !requireBundles.isEmpty()) {
for (ParameterizedAttribute attr : requireBundles) {
String bundleName = attr.getAttribute();
XRequirement req = addRequirement(BundleNamespace.BUNDLE_NAMESPACE, bundleName);
Expand All @@ -226,15 +226,15 @@ public XResourceBuilder<T> loadFrom(OSGiMetaData metadata) throws ResourceBuilde

// Required Execution Environment
List<String> requiredEnvironments = metadata.getRequiredExecutionEnvironment();
if (requiredEnvironments != null && requiredEnvironments.isEmpty() == false) {
if (requiredEnvironments != null && !requiredEnvironments.isEmpty()) {
// Frameworks must convert a Bundle-RequiredExecutionEnvironment header to a requirement in the osgi.ee namespace
Filter filter = OSGiMetaDataBuilder.convertExecutionEnvironmentHeader(requiredEnvironments);
addRequirement(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE, filter);
}

// Export-Package
List<PackageAttribute> exports = metadata.getExportPackages();
if (exports != null && exports.isEmpty() == false) {
if (exports != null && !exports.isEmpty()) {
for (PackageAttribute attr : exports) {
String packageName = attr.getAttribute();
XCapability cap = addCapability(PackageNamespace.PACKAGE_NAMESPACE, packageName);
Expand Down Expand Up @@ -263,7 +263,7 @@ public XResourceBuilder<T> loadFrom(OSGiMetaData metadata) throws ResourceBuilde

// Import-Package
List<PackageAttribute> imports = metadata.getImportPackages();
if (imports != null && imports.isEmpty() == false) {
if (imports != null && !imports.isEmpty()) {
for (PackageAttribute attr : imports) {
String packageName = attr.getAttribute();
XRequirement req = addRequirement(PackageNamespace.PACKAGE_NAMESPACE, packageName);
Expand All @@ -274,7 +274,7 @@ public XResourceBuilder<T> loadFrom(OSGiMetaData metadata) throws ResourceBuilde

// DynamicImport-Package
List<PackageAttribute> dynamicImports = metadata.getDynamicImports();
if (dynamicImports != null && dynamicImports.isEmpty() == false) {
if (dynamicImports != null && !dynamicImports.isEmpty()) {
for (PackageAttribute attr : dynamicImports) {
String packageName = attr.getAttribute();
Map<String, Object> atts = new LinkedHashMap<String, Object>();
Expand All @@ -289,7 +289,7 @@ public XResourceBuilder<T> loadFrom(OSGiMetaData metadata) throws ResourceBuilde

// Provide-Capability
List<ParameterizedAttribute> providedCapabilities = metadata.getProvidedCapabilities();
if (providedCapabilities != null && providedCapabilities.isEmpty() == false) {
if (providedCapabilities != null && !providedCapabilities.isEmpty()) {
for (ParameterizedAttribute attr : providedCapabilities) {
String capname = attr.getAttribute();
XCapability cap = addCapability(capname, null, null);
Expand All @@ -300,7 +300,7 @@ public XResourceBuilder<T> loadFrom(OSGiMetaData metadata) throws ResourceBuilde

// Require-Capability
List<ParameterizedAttribute> requiredCapabilities = metadata.getRequiredCapabilities();
if (requiredCapabilities != null && requiredCapabilities.isEmpty() == false) {
if (requiredCapabilities != null && !requiredCapabilities.isEmpty()) {
for (ParameterizedAttribute attr : requiredCapabilities) {
String reqname = attr.getAttribute();
XRequirement req = addRequirement(reqname, null, null);
Expand Down
Expand Up @@ -161,7 +161,7 @@ public void filterResolvable() {
Collection<BundleRevision> before = new HashSet<BundleRevision>(candidates);
hook.filterResolvable(candidates);
for (BundleRevision aux : before) {
if (candidates.contains(aux) == false) {
if (!candidates.contains(aux)) {
LOGGER.debugf("ResolverHook filtered resolvable: %s", aux);
}
}
Expand Down Expand Up @@ -251,7 +251,7 @@ private boolean processCollisionCandidates(BundleCapability bcap, Collection<Bun
}

private void populateCollisionCandidates(BundleCapability bcap, Map<BundleCapability, Collection<BundleCapability>> map, SingletonLocator locator) {
if (map.containsKey(bcap) == false) {
if (!map.containsKey(bcap)) {
Collection<BundleCapability> candidates = locator.findCollisionCandidates(bcap);
map.put(bcap, new RemoveOnlyCollection<BundleCapability>(candidates));
}
Expand All @@ -266,7 +266,7 @@ public void filterMatches(BundleRequirement breq, Collection<BundleCapability> m
Collection<BundleCapability> before = new HashSet<BundleCapability>(matching);
hook.filterMatches(breq, matching);
for (BundleCapability aux : before) {
if (matching.contains(aux) == false) {
if (!matching.contains(aux)) {
LOGGER.debugf("ResolverHook filtered match: %s", aux);
}
}
Expand Down Expand Up @@ -322,7 +322,7 @@ boolean isRegistered() {
}

ResolverHook getResolverHook() {
if (isRegistered() == false) {
if (!isRegistered()) {
throw MESSAGES.illegalStateResolverHookUnregistered(sref);
}
return hook;
Expand Down

0 comments on commit 04fd626

Please sign in to comment.