Mercurial > hg4j
annotate src/org/tmatesoft/hg/util/Path.java @ 519:934037edbea0
Few toString() implementations to ease debug
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> | 
|---|---|
| date | Thu, 20 Dec 2012 20:21:59 +0100 | 
| parents | 072b5f3ed0c8 | 
| children | fedc54356091 49f0749307a0 | 
| rev | line source | 
|---|---|
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 1 /* | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 2 * Copyright (c) 2011-2012 TMate Software Ltd | 
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 3 * | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 4 * This program is free software; you can redistribute it and/or modify | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 5 * it under the terms of the GNU General Public License as published by | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 6 * the Free Software Foundation; version 2 of the License. | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 7 * | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 8 * This program is distributed in the hope that it will be useful, | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 11 * GNU General Public License for more details. | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 12 * | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 13 * For information on how to redistribute this software under | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 14 * the terms of a license other than GNU General Public License | 
| 102 
a3a2e5deb320
Updated contact address to support@hg4j.com
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
77diff
changeset | 15 * contact TMate Software at support@hg4j.com | 
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 16 */ | 
| 133 
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 17 package org.tmatesoft.hg.util; | 
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 18 | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 19 import java.util.Collection; | 
| 339 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 20 import java.util.Iterator; | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 21 import java.util.NoSuchElementException; | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 22 | 
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 23 /** | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 24 * Identify repository files (not String nor io.File). Convenient for pattern matching. Memory-friendly. | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 25 * | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 26 * @author Artem Tikhomirov | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 27 * @author TMate Software Ltd. | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 28 */ | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 29 public final class Path implements CharSequence, Comparable<Path>/*Cloneable? - although clone for paths make no sense*/{ | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 30 // private String[] segments; | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 31 // private int flags; // dir, unparsed | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 32 private String path; | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 33 | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 34 /*package-local*/Path(String p) { | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 35 path = p; | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 36 } | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 37 | 
| 148 
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
141diff
changeset | 38 /** | 
| 
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
141diff
changeset | 39 * Check if this is directory's path. | 
| 
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
141diff
changeset | 40 * Note, this method doesn't perform any file system operation. | 
| 
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
141diff
changeset | 41 * | 
| 
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
141diff
changeset | 42 * @return true when this path points to a directory | 
| 
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
141diff
changeset | 43 */ | 
| 
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
141diff
changeset | 44 public boolean isDirectory() { | 
| 
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
141diff
changeset | 45 // XXX simple logic for now. Later we may decide to have an explicit factory method to create directory paths | 
| 
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
141diff
changeset | 46 return path.charAt(path.length() - 1) == '/'; | 
| 
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
141diff
changeset | 47 } | 
| 
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
141diff
changeset | 48 | 
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 49 public int length() { | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 50 return path.length(); | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 51 } | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 52 | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 53 public char charAt(int index) { | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 54 return path.charAt(index); | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 55 } | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 56 | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 57 public CharSequence subSequence(int start, int end) { | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 58 // new Path if start-end matches boundaries of any subpath | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 59 return path.substring(start, end); | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 60 } | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 61 | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 62 @Override | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 63 public String toString() { | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 64 return path; // CharSequence demands toString() impl | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 65 } | 
| 339 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 66 | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 67 public Iterable<String> segments() { | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 68 class SegSeq implements Iterable<String>, Iterator<String> { | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 69 private int pos; // first char to return | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 70 | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 71 public Iterator<String> iterator() { | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 72 reset(); | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 73 return this; | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 74 } | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 75 public boolean hasNext() { | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 76 return pos < path.length(); | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 77 } | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 78 public String next() { | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 79 if (pos >= path.length()) { | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 80 throw new NoSuchElementException(); | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 81 } | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 82 int x = path.indexOf('/', pos); | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 83 if (x == -1) { | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 84 String rv = path.substring(pos); | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 85 pos = path.length(); | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 86 return rv; | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 87 } else { | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 88 String rv = path.substring(pos, x); | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 89 pos = x+1; | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 90 return rv; | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 91 } | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 92 } | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 93 public void remove() { | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 94 throw new UnsupportedOperationException(); | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 95 } | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 96 | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 97 private void reset() { | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 98 pos = 0; | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 99 } | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 100 }; | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 101 return new SegSeq(); | 
| 
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
292diff
changeset | 102 } | 
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 103 | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 104 public int compareTo(Path o) { | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 105 return path.compareTo(o.path); | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 106 } | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 107 | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 108 @Override | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 109 public boolean equals(Object obj) { | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 110 if (obj != null && getClass() == obj.getClass()) { | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 111 return this == obj || path.equals(((Path) obj).path); | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 112 } | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 113 return false; | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 114 } | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 115 @Override | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 116 public int hashCode() { | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 117 return path.hashCode(); | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 118 } | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 119 | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 120 public enum CompareResult { | 
| 443 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 121 Same, Unrelated, ImmediateChild, Nested, ImmediateParent, Parent /* +CommonParent ?*/ | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 122 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 123 | 
| 443 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 124 /** | 
| 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 125 * @return one of {@link CompareResult} constants to indicate relations between the paths | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 126 */ | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 127 public CompareResult compareWith(Path another) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 128 if (another == null) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 129 return CompareResult.Unrelated; // XXX perhaps, IAE? | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 130 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 131 if (another == this || (another.length() == length() && equals(another))) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 132 return CompareResult.Same; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 133 } | 
| 443 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 134 // one of the parties can't be parent in parent/nested, the other may be either file or folder | 
| 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 135 if (another.isDirectory() && path.startsWith(another.path)) { | 
| 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 136 return isOneSegmentDifference(path, another.path) ? CompareResult.ImmediateChild : CompareResult.Nested; | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 137 } | 
| 443 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 138 if (isDirectory() && another.path.startsWith(path)) { | 
| 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 139 return isOneSegmentDifference(another.path, path) ? CompareResult.ImmediateParent : CompareResult.Parent; | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 140 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 141 return CompareResult.Unrelated; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 142 } | 
| 443 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 143 | 
| 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 144 // true if p1 is only one segment larger than p2 | 
| 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 145 private static boolean isOneSegmentDifference(String p1, String p2) { | 
| 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 146 assert p1.startsWith(p2); | 
| 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 147 String p1Tail= p1.substring(p2.length()); | 
| 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 148 int slashLoc = p1Tail.indexOf('/'); | 
| 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 149 return slashLoc == -1 || slashLoc == p1Tail.length() - 1; | 
| 
072b5f3ed0c8
Path to tell immediate parent-child relationship; more powerful scope impl; tests for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 150 } | 
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 151 | 
| 292 
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
229diff
changeset | 152 public static Path create(CharSequence path) { | 
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 153 if (path == null) { | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 154 throw new IllegalArgumentException(); | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 155 } | 
| 292 
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
229diff
changeset | 156 if (path instanceof Path) { | 
| 
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
229diff
changeset | 157 Path o = (Path) path; | 
| 
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
229diff
changeset | 158 return o; | 
| 
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
229diff
changeset | 159 } | 
| 
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
229diff
changeset | 160 String p = path.toString(); | 
| 
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
229diff
changeset | 161 if (p.indexOf('\\') != -1) { | 
| 77 
c677e1593919
Moved RevlogStream implementation into .internal
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
64diff
changeset | 162 throw new IllegalArgumentException(); | 
| 
c677e1593919
Moved RevlogStream implementation into .internal
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
64diff
changeset | 163 } | 
| 292 
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
229diff
changeset | 164 Path rv = new Path(p); | 
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 165 return rv; | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 166 } | 
| 133 
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 167 | 
| 
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 168 /** | 
| 
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 169 * Path filter. | 
| 
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 170 */ | 
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 171 public interface Matcher { | 
| 141 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 172 boolean accept(Path path); | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 173 | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 174 final class Any implements Matcher { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 175 public boolean accept(Path path) { return true; } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 176 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 177 class Composite implements Matcher { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 178 private final Path.Matcher[] elements; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 179 | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 180 public Composite(Collection<Path.Matcher> matchers) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 181 elements = matchers.toArray(new Path.Matcher[matchers.size()]); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 182 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 183 | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 184 public boolean accept(Path path) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 185 for (Path.Matcher m : elements) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 186 if (m.accept(path)) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 187 return true; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 188 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 189 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 190 return false; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 191 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 192 } | 
| 141 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 193 } | 
| 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 194 | 
| 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 195 /** | 
| 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 196 * Factory for paths | 
| 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 197 */ | 
| 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 198 public interface Source { | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 199 Path path(CharSequence p); | 
| 141 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 200 } | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 201 | 
| 141 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 202 /** | 
| 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 203 * Straightforward {@link Source} implementation that creates new Path instance for each supplied string | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 204 * and optionally piping through a converter to get e.g. cached instance | 
| 141 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 205 */ | 
| 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 206 public static class SimpleSource implements Source { | 
| 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 207 private final PathRewrite normalizer; | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 208 private final Convertor<Path> convertor; | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 209 | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 210 public SimpleSource() { | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 211 this(new PathRewrite.Empty(), null); | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 212 } | 
| 141 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 213 | 
| 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 214 public SimpleSource(PathRewrite pathRewrite) { | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 215 this(pathRewrite, null); | 
| 141 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 216 } | 
| 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 217 | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 218 public SimpleSource(PathRewrite pathRewrite, Convertor<Path> pathConvertor) { | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 219 normalizer = pathRewrite; | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 220 convertor = pathConvertor; | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 221 } | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 222 | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 223 public Path path(CharSequence p) { | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 224 Path rv = Path.create(normalizer.rewrite(p)); | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 225 if (convertor != null) { | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 226 return convertor.mangle(rv); | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 227 } | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
339diff
changeset | 228 return rv; | 
| 141 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 229 } | 
| 64 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 230 } | 
| 
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 231 } | 
