protected static boolean compareVersions(VulnerableSoftware vs, String targetVersion) {
        if (LogicalValue.NA.getAbbreviation().equals(vs.getVersion())) {
            return false;
        }
        //if any of the four conditions will be evaluated - then true;
        boolean result = (vs.versionEndExcluding != null && !vs.versionEndExcluding.isEmpty())
                || (vs.versionStartExcluding != null && !vs.versionStartExcluding.isEmpty())
                || (vs.versionEndIncluding != null && !vs.versionEndIncluding.isEmpty())
                || (vs.versionStartIncluding != null && !vs.versionStartIncluding.isEmpty());

        if (!result && compareAttributes(vs.getVersion(), targetVersion)) {
            return true;
        }

        final DependencyVersion target = new DependencyVersion(targetVersion);
        if (target.getVersionParts().isEmpty()) {
            return false;
        }
        if (result && vs.versionEndExcluding != null && !vs.versionEndExcluding.isEmpty()) {
            final DependencyVersion endExcluding = new DependencyVersion(vs.versionEndExcluding);
            result = endExcluding.compareTo(target) > 0;
        }
        if (result && vs.versionStartExcluding != null && !vs.versionStartExcluding.isEmpty()) {
            final DependencyVersion startExcluding = new DependencyVersion(vs.versionStartExcluding);
            result = startExcluding.compareTo(target) < 0;
        }
        if (result && vs.versionEndIncluding != null && !vs.versionEndIncluding.isEmpty()) {
            final DependencyVersion endIncluding = new DependencyVersion(vs.versionEndIncluding);
            result &= endIncluding.compareTo(target) >= 0;
        }
        if (result && vs.versionStartIncluding != null && !vs.versionStartIncluding.isEmpty()) {
            final DependencyVersion startIncluding = new DependencyVersion(vs.versionStartIncluding);
            result &= startIncluding.compareTo(target) <= 0;
        }
        return result;
    }
protected static boolean compareVersions ( VulnerableSoftware vs , String targetVersion ) { if ( LogicalValue . NA . getAbbreviation ( ) . equals ( vs . getVersion ( ) ) ) { return false ; } boolean result = ( vs . versionEndExcluding != null && ! vs . versionEndExcluding . isEmpty ( ) ) || ( vs . versionStartExcluding != null && ! vs . versionStartExcluding . isEmpty ( ) ) || ( vs . versionEndIncluding != null && ! vs . versionEndIncluding . isEmpty ( ) ) || ( vs . versionStartIncluding != null && ! vs . versionStartIncluding . isEmpty ( ) ) ; if ( ! result && compareAttributes ( vs . getVersion ( ) , targetVersion ) ) { return true ; } final DependencyVersion target = new DependencyVersion ( targetVersion ) ; if ( target . getVersionParts ( ) . isEmpty ( ) ) { return false ; } if ( result && vs . versionEndExcluding != null && ! vs . versionEndExcluding . isEmpty ( ) ) { final DependencyVersion endExcluding = new DependencyVersion ( vs . versionEndExcluding ) ; result = endExcluding . compareTo ( target ) > 0 ; } if ( result && vs . versionStartExcluding != null && ! vs . versionStartExcluding . isEmpty ( ) ) { final DependencyVersion startExcluding = new DependencyVersion ( vs . versionStartExcluding ) ; result = startExcluding . compareTo ( target ) < 0 ; } if ( result && vs . versionEndIncluding != null && ! vs . versionEndIncluding . isEmpty ( ) ) { final DependencyVersion endIncluding = new DependencyVersion ( vs . versionEndIncluding ) ; result &= endIncluding . compareTo ( target ) >= 0 ; } if ( result && vs . versionStartIncluding != null && ! vs . versionStartIncluding . isEmpty ( ) ) { final DependencyVersion startIncluding = new DependencyVersion ( vs . versionStartIncluding ) ; result &= startIncluding . compareTo ( target ) <= 0 ; } return result ; }
Evaluates the target against the version and version range checks:
versionEndExcluding, versionStartExcluding versionEndIncluding, and
versionStartIncluding.

@param vs a reference to the vulnerable software to compare
@param targetVersion the version to compare
@return <code>true</code> if the target version is matched; otherwise
<code>false</code>