// Path: rfc3986-uri/src/main/java/org/dmfs/rfc3986/Path.java
// public interface Path extends Iterable<UriEncoded>
// {
//     /**
//      * Returns whether this path is empty, i.e. contains no path segments.
//      *
//      * @return {@code true} if this path is empty, {@code false} otherwise.
//      */
//     boolean isEmpty();
// 
//     /**
//      * Returns whether this path is absolute, i.e. starts with a "/".
//      *
//      * @return {@code true} if this path is absolute, {@code false} otherwise.
//      */
//     boolean isAbsolute();
// }
// 
// Path: rfc3986-uri/src/main/java/org/dmfs/rfc3986/UriEncoded.java
// public interface UriEncoded extends CharSequence
// {
//     /**
//      * Returns a normalized version of this {@link UriEncoded}. In particular that means any percent-encoded unreserved characters are decoded and
//      * percent-encoding sequences are converted to uppercase.
//      *
//      * @return The normalized version of this {@link UriEncoded}.
//      */
//     UriEncoded normalized();
// 
//     /**
//      * Returns the decoded text, using the given charset to decode the non-ASCII characters.
//      *
//      * @param charset
//      *         The name of the charset.
//      *
//      * @return
//      */
//     CharSequence decoded(String charset) throws UnsupportedEncodingException;
// 
//     /**
//      * Returns the decoded text assuming UTF-8 encoding.
//      *
//      * @return
//      */
//     CharSequence decoded();
// 
//     @Override
//     UriEncoded subSequence(int startIndex, int endIndex);
// 
//     @Override
//     String toString();
// }
// 
// Path: rfc3986-uri/src/main/java/org/dmfs/rfc3986/utils/Parsed.java
// public interface Parsed
// {
//     /**
//      * The length of the component in the source.
//      *
//      * @return
//      */
//     int parsedLength();
// }
// 
// Path: rfc3986-uri/src/main/java/org/dmfs/rfc3986/validation/CharSets.java
// public final static CharSet PCHAR = new BitMapCharSet(0, 0x2FFF7FF2, 0x87FFFFFF, 0x47FFFFFE);


import org.dmfs.rfc3986.Path;
import org.dmfs.rfc3986.UriEncoded;
import org.dmfs.rfc3986.utils.Parsed;
import java.util.Iterator;
import static org.dmfs.rfc3986.validation.CharSets.PCHAR;


    private Path path()
    {
        if (mDelegate == null)
        {
            mDelegate = parsedPath();
        }
        return mDelegate;
    }


    private Path parsedPath()
    {
        final UriEncoded uriEncoded = mUriEncoded;
        final int count = uriEncoded.length();
        int i = 0;
        if (i == count)
        {
            return EmptyPath.INSTANCE;
        }
        while (i < count && (PCHAR.contains(uriEncoded.charAt(i)) || uriEncoded.charAt(i) == '/'))
        {
            ++i;
        }
        mEnd = i;
        return new EncodedPath(uriEncoded.subSequence(0, i));
    }


// Path: rfc3986-uri/src/main/java/org/dmfs/rfc3986/Path.java
// public interface Path extends Iterable<UriEncoded>
// {
//     /**
//      * Returns whether this path is empty, i.e. contains no path segments.
//      *
//      * @return {@code true} if this path is empty, {@code false} otherwise.
//      */
//     boolean isEmpty();
// 
//     /**
//      * Returns whether this path is absolute, i.e. starts with a "/".
//      *
//      * @return {@code true} if this path is absolute, {@code false} otherwise.
//      */
//     boolean isAbsolute();
// }
// 
// Path: rfc3986-uri/src/main/java/org/dmfs/rfc3986/UriEncoded.java
// public interface UriEncoded extends CharSequence
// {
//     /**
//      * Returns a normalized version of this {@link UriEncoded}. In particular that means any percent-encoded unreserved characters are decoded and
//      * percent-encoding sequences are converted to uppercase.
//      *
//      * @return The normalized version of this {@link UriEncoded}.
//      */
//     UriEncoded normalized();
// 
//     /**
//      * Returns the decoded text, using the given charset to decode the non-ASCII characters.
//      *
//      * @param charset
//      *         The name of the charset.
//      *
//      * @return
//      */
//     CharSequence decoded(String charset) throws UnsupportedEncodingException;
// 
//     /**
//      * Returns the decoded text assuming UTF-8 encoding.
//      *
//      * @return
//      */
//     CharSequence decoded();
// 
//     @Override
//     UriEncoded subSequence(int startIndex, int endIndex);
// 
//     @Override
//     String toString();
// }
// 
// Path: rfc3986-uri/src/main/java/org/dmfs/rfc3986/utils/Parsed.java
// public interface Parsed
// {
//     /**
//      * The length of the component in the source.
//      *
//      * @return
//      */
//     int parsedLength();
// }
// 
// Path: rfc3986-uri/src/main/java/org/dmfs/rfc3986/validation/CharSets.java
// public final static CharSet PCHAR = new BitMapCharSet(0, 0x2FFF7FF2, 0x87FFFFFF, 0x47FFFFFE);


// Path: rfc3986-uri/src/main/java/org/dmfs/rfc3986/paths/LazyPath.java
import org.dmfs.rfc3986.Path;
import org.dmfs.rfc3986.UriEncoded;
import org.dmfs.rfc3986.utils.Parsed;
import java.util.Iterator;
import static org.dmfs.rfc3986.validation.CharSets.PCHAR;



    private Path path()
    {
        if (mDelegate == null)
        {
            mDelegate = parsedPath();
        }
        return mDelegate;
    }


    private Path parsedPath()
    {
        final UriEncoded uriEncoded = mUriEncoded;
        final int count = uriEncoded.length();
        int i = 0;
        if (i == count)
        {
            return EmptyPath.INSTANCE;
        }
        while (i < count && (PCHAR.contains(uriEncoded.charAt(i)) || uriEncoded.charAt(i) == '/'))
        {
            ++i;
        }
        mEnd = i;
        return new EncodedPath(uriEncoded.subSequence(0, i));
    }


    @Override