comparison src/org/tmatesoft/hg/util/Path.java @ 292:a415fe296a50

Refactor PathRewrite to accept any char sequence, not only string
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 14 Sep 2011 02:16:19 +0200
parents 1ec6b327a6ac
children 863356c2847e
comparison
equal deleted inserted replaced
291:1483e57541ef 292:a415fe296a50
99 return CompareResult.Parent; 99 return CompareResult.Parent;
100 } 100 }
101 return CompareResult.Unrelated; 101 return CompareResult.Unrelated;
102 } 102 }
103 103
104 public static Path create(String path) { 104 public static Path create(CharSequence path) {
105 if (path == null) { 105 if (path == null) {
106 throw new IllegalArgumentException(); 106 throw new IllegalArgumentException();
107 } 107 }
108 if (path.indexOf('\\') != -1) { 108 if (path instanceof Path) {
109 Path o = (Path) path;
110 return o;
111 }
112 String p = path.toString();
113 if (p.indexOf('\\') != -1) {
109 throw new IllegalArgumentException(); 114 throw new IllegalArgumentException();
110 } 115 }
111 Path rv = new Path(path); 116 Path rv = new Path(p);
112 return rv; 117 return rv;
113 } 118 }
114 119
115 /** 120 /**
116 * Path filter. 121 * Path filter.