/**
  * Changes the base scheme, host and port of this MutableUri to that specified in a base URI, or
  * leaves them unchanged if the base URI is {@code null}. This implementation only uses scheme,
  * host and port. The remaining components of the URI remain intact.
  *
  * @param base the URI to base the other URI on.
  * @return this (rebased) instance
  */
 public MutableUri rebase(MutableUri base) {
   if (base == null) {
     return this;
   }
   String scheme = base.getScheme();
   String host = base.getHost();
   int port = base.getPort();
   if (scheme == null || host == null) {
     return this;
   }
   try {
     setScheme(scheme);
     setHost(host);
     setPort(port);
   } catch (URISyntaxException e) {
     throw new IllegalStateException(e);
   }
   return this;
 }
 /**
  * Builds a new MutableUri with deep copy.
  *
  * @param mutableUri URI
  */
 public MutableUri(final MutableUri mutableUri) {
   this(mutableUri.asURI());
 }
 /**
  * Resolves the given URI against this URI.
  *
  * @param uri the uri to resolve against this instance
  * @return this instance (mutated)
  * @see URI#resolve(URI)
  */
 public MutableUri resolve(final MutableUri uri) {
   this.uri = this.uri.resolve(uri.asURI());
   return this;
 }
 @Override
 public int compareTo(final MutableUri o) {
   return asURI().compareTo(o.asURI());
 }