@Override public boolean startsWith( Path ancestor ) { return ancestor.size() == 0; }
@Override public int compareTo( Path that ) { if (that == this) return 0; if (that instanceof EmptyPath) return 0; return 0 - that.size(); }
@Override public int compareTo( Path that ) { if (that == this) return 0; if (that instanceof EmptyPath) return 0; return 0 - that.size(); }
@Override public boolean equals( Object obj ) { if (obj == this) return true; if (obj instanceof Path) { Path that = (Path)obj; return that.size() == 0; } return false; }
@Override public boolean equals( Object obj ) { if (obj == this) return true; if (obj instanceof Path) { Path that = (Path)obj; return that.size() == 0; } return false; }
@Override public boolean startsWith( Path ancestor ) { return ancestor.size() == 0; }
@Override public boolean startsWith( Path other ) { if (other.size() > this.size()) return false; Iterator<String> thatIter = other.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext() && thisIter.hasNext()) { if (!thisIter.next().equals(thatIter.next())) return false; } return !thatIter.hasNext(); }
@Override public boolean startsWith( Path other ) { if (other.size() > this.size()) return false; Iterator<String> thatIter = other.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext() && thisIter.hasNext()) { if (!thisIter.next().equals(thatIter.next())) return false; } return !thatIter.hasNext(); }
@Override public boolean equals( Object obj ) { if (obj == this) return true; if (obj instanceof SinglePath) { SinglePath that = (SinglePath)obj; return this.fieldName.equals(that.fieldName); } if (obj instanceof Path) { Path that = (Path)obj; if (this.size() != that.size()) return false; return this.fieldName.equals(that.get(0)); } return false; }
@Override public int compareTo( Path that ) { if (that == this) return 0; int diff = this.size() - that.size(); if (diff != 0) return diff; Iterator<String> thatIter = that.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext()) { int value = thisIter.next().compareTo(thatIter.next()); if (value != 0) return value; } assert !thisIter.hasNext(); return 0; }
@Override public int compareTo( Path that ) { if (that == this) return 0; int diff = this.size() - that.size(); if (diff != 0) return diff; return this.fieldName.compareTo(that.get(0)); }
@Override public int compareTo( Path that ) { if (that == this) return 0; int diff = this.size() - that.size(); if (diff != 0) return diff; return this.fieldName.compareTo(that.get(0)); }
@Override public boolean equals( Object obj ) { if (obj == this) return true; if (obj instanceof SinglePath) { SinglePath that = (SinglePath)obj; return this.fieldName.equals(that.fieldName); } if (obj instanceof Path) { Path that = (Path)obj; if (this.size() != that.size()) return false; return this.fieldName.equals(that.get(0)); } return false; }
@Override public int compareTo( Path that ) { if (that == this) return 0; int diff = this.size() - that.size(); if (diff != 0) return diff; Iterator<String> thatIter = that.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext()) { int value = thisIter.next().compareTo(thatIter.next()); if (value != 0) return value; } assert !thisIter.hasNext(); return 0; }
@Override public boolean equals( Object obj ) { if (obj == this) return true; if (obj instanceof Path) { Path that = (Path)obj; if (this.size() != that.size()) return false; Iterator<String> thatIter = that.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext()) { if (!thisIter.next().equals(thatIter.next())) return false; } assert !thisIter.hasNext(); return true; } return false; }
@Override public boolean equals( Object obj ) { if (obj == this) return true; if (obj instanceof Path) { Path that = (Path)obj; if (this.size() != that.size()) return false; Iterator<String> thatIter = that.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext()) { if (!thisIter.next().equals(thatIter.next())) return false; } assert !thisIter.hasNext(); return true; } return false; }
public static Path path( Path path, List<String> fieldNames ) { notNull(path, "path"); notNull(fieldNames, "fieldNames"); if (fieldNames.isEmpty()) return path; ArrayList<String> names = new ArrayList<>(path.size() + fieldNames.size()); int i = 0; for (String name : path) { names.add(notNull(name, "fieldNames[" + i++ + "]")); } for (String name : fieldNames) { names.add(notNull(name, "fieldNames[" + i++ + "]")); } return new MultiSegmentPath(names); }
public static Path path( Path path, List<String> fieldNames ) { notNull(path, "path"); notNull(fieldNames, "fieldNames"); if (fieldNames.isEmpty()) return path; ArrayList<String> names = new ArrayList<>(path.size() + fieldNames.size()); int i = 0; for (String name : path) { names.add(notNull(name, "fieldNames[" + i++ + "]")); } for (String name : fieldNames) { names.add(notNull(name, "fieldNames[" + i++ + "]")); } return new MultiSegmentPath(names); }
public static Path path( Path path, String... fieldNames ) { notNull(path, "path"); notNull(fieldNames, "fieldNames"); if (fieldNames.length == 0) return path; ArrayList<String> names = new ArrayList<>(path.size() + fieldNames.length); int i = 0; for (String name : path) { names.add(notNull(name, "fieldNames[" + i++ + "]")); } for (String name : fieldNames) { names.add(notNull(name, "fieldNames[" + i++ + "]")); } return new MultiSegmentPath(names); }
public static Path path( Path path, String... fieldNames ) { notNull(path, "path"); notNull(fieldNames, "fieldNames"); if (fieldNames.length == 0) return path; ArrayList<String> names = new ArrayList<>(path.size() + fieldNames.length); int i = 0; for (String name : path) { names.add(notNull(name, "fieldNames[" + i++ + "]")); } for (String name : fieldNames) { names.add(notNull(name, "fieldNames[" + i++ + "]")); } return new MultiSegmentPath(names); }