@Override
  public VersionConstraint merge(VersionConstraint versionConstraint)
      throws IncompatibleVersionConstraintException {
    if (equals(versionConstraint)) {
      return this;
    } else {
      VersionConstraint mergedConstraint = mergeVersions(versionConstraint);

      return mergedConstraint == null
          ? mergeRanges(versionConstraint.getRanges())
          : mergedConstraint;
    }
  }
  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }

    if (obj == null || !(obj instanceof VersionConstraint)) {
      return false;
    }

    VersionConstraint versionConstraint = (VersionConstraint) obj;

    return this.ranges.equals(versionConstraint.getRanges())
        && ObjectUtils.equals(this.version, versionConstraint.getVersion());
  }
 /**
  * Created a new {@link DefaultVersionConstraint} by cloning the provided version constraint.
  *
  * @param versionConstraint the version constrain to copy
  */
 public DefaultVersionConstraint(VersionConstraint versionConstraint) {
   this(versionConstraint.getRanges(), versionConstraint.getVersion());
 }