Combine two or more paths

@param first parent directory path
@param other children
@return combined path
190646
public static String combinePaths(String first, String... other) {
        return Paths.get(first, other).toString();
    }
352585
public boolean startsWith(Path other) {
		if (isAbsolute() != other.isAbsolute())
			return false;
		List<String> otherSegments = other.getSegments();
		List<String> thisSegments = getSegments();
		int otherSegmentSize = otherSegments.size();
		int thisSegmentSize = thisSegments.size();
		if (otherSegmentSize > thisSegmentSize) {
			return false;
		}
		for (int i = 0; i < otherSegmentSize; i++) {
			String otherSeg = otherSegments.get(i);
			String thisSeg = thisSegments.get(i);
			if (!otherSeg.equals(thisSeg))
				return false;
		}
		return true;
	}
28183
def merge(self, other):
        
        for child_name, child in other.children.items():
            self.add_child(child_name, child)
792348
protected final JimfsPath createPathInternal(@Nullable Name root, Iterable<Name> names) {
    return new JimfsPath(this, root, names);
  }
27627
public static String getRelativePath(String base, String child) {
        return new File(base).toURI().relativize(new File(child).toURI()).getPath();
    }
297119
function (childDirName, parentPath, parent) {
		parentPath = parentPath || "";
		if (arguments.length < 3) {
			parent = { 
				config: {},
			};
		}

		return {
			name: childDirName,
			path: path.join(parentPath, childDirName),
			parentRoute: '/' + parentPath,
			config: {},
			parent: parent,
		};
	}
317292
public void addChildren( PlanNode first,
                             PlanNode second,
                             PlanNode third ) {
        if (first != null) this.addLastChild(first);
        if (second != null) this.addLastChild(second);
        if (third != null) this.addLastChild(third);
    }
207378
public void addChildren( Iterable<PlanNode> otherChildren ) {
        assert otherChildren != null;
        for (PlanNode planNode : otherChildren) {
            this.addLastChild(planNode);
        }
    }
615953
public AbstractNode combine(AbstractNode midd1, AbstractNode midd2) throws MIDDException {

        if (midd1 instanceof ExternalNode3) {
            if (midd2 instanceof ExternalNode3) {
                return combineExternalNodes((ExternalNode3) midd1, (ExternalNode3) midd2);            // combine two external nodes
            } else {
                ExternalNode3 n1 = (ExternalNode3) midd1;
                InternalNode<?> n2 = (InternalNode<?>) midd2;
                return combineIDD(n1, n2); // combine an external node n1 with an internal node n2
            }
        } else {
            InternalNode<?> n1 = (InternalNode<?>) midd1;

            if (midd2 instanceof ExternalNode3) {
                // combine an internal node (midd1) with an external node (midd2)
                ExternalNode3 n2 = (ExternalNode3) midd2;
                return combineIDD(n1, n2);     // combine an internal node n1 with an external node2
            } else {
                // both are internal nodes, combine two internal nodes here
                InternalNode<?> n2 = (InternalNode<?>) midd2;

                if (n1.getID() == n2.getID()) {
                    return combineIDDSameLevel(n1, n2);
                } else {
                    //Algorithm: find a node with lower order, e.g: n1
                    // - Create a node clone from n1 -> n
                    // - combine n2 with all children of n1 -> children[1..k], add them to children of n

                    InternalNode<?> n = null;
                    if (n1.getID() < n2.getID()) {

                        // Clone n1
                        n = NodeUtils.createInternalNode(n1, n1.getType());

                        for (AbstractEdge<?> e : n1.getEdges()) {
                            AbstractNode child = combine(e.getSubDiagram(), n2);
                            if (child != null) {
                                n.addChild(EdgeUtils.cloneEdge(e), child);
                            } else {
                                log.error("empty child");
                            }
                        }

                        // Create a new edge containing the complement of n1 children intervals, connecting n with n2
                        List<Interval<?>> complementIntervals = IntervalUtils.complement(n1.getIntervals());
                        if (complementIntervals.size() > 0) {
                            AbstractEdge<?> edge = EdgeUtils.createEdge(complementIntervals, n1.getType());
                            n.addChild(edge, n2);
                        }

                    } else { // n2 has lower id than n1, do in other way.
                        n = NodeUtils.createInternalNode(n2, n2.getType());
                        for (AbstractEdge<?> e : n2.getEdges()) {
                            AbstractNode child = combine(n1, e.getSubDiagram());
                            if (child != null) {
                                n.addChild(EdgeUtils.cloneEdge(e), child);
                            }
                        }
                        // Create a new edge containing the complement of n2 children intervals, connecting n with n1
                        List<Interval<?>> complementIntervals = IntervalUtils.complement(n2.getIntervals());
                        if (complementIntervals.size() > 0) {
                            AbstractEdge<?> edge = EdgeUtils.createEdge(complementIntervals, n2.getType());
                            n.addChild(edge, n1);
                        }
                    }
                    if (n.getEdges().size() > 0) {
                        return n;
                    } else {
                        return null;
                    }
                }
            }
        }
    }
713219
def n_parent_paths(self, n):
        
        rv = os.path.relpath(os.path.join(self.path, '..'), os.path.join(self.path, *['..'] * (n+1)))
        return rv.replace('\\', '/')
157267
public static function Combine( string $basePath, string $next1, string $next2 = null ) : string
   {
      if ( empty( $next2 ) )
      {
         return (
            \rtrim( $basePath, "\r\n\t /\\" )
               . \DIRECTORY_SEPARATOR
               . \ltrim( $next1, "\r\n\t /\\" )
         );
      }
      return (
         \rtrim( $basePath, "\r\n\t /\\" )
            . \DIRECTORY_SEPARATOR
            . \trim( $next1, "\r\n\t /\\" )
            . \DIRECTORY_SEPARATOR
            . \ltrim( $next2, "\r\n\t /\\" )
       );
   }
551518
public static String joinPaths(String prefix, String path, boolean generatedPath) {

		String result = null;
		if (generatedPath) {
			result = joinDomainToPath(prefix, path);
		} else {
			result = joinPaths(prefix, path);
		}
		return result;
	}
1227800
public static QPath makeChildPath(final QPath parent, final QName name, final int itemIndex)
   {

      QPathEntry[] parentEntries = parent.getEntries();
      QPathEntry[] names = new QPathEntry[parentEntries.length + 1];
      int index = 0;
      for (QPathEntry pname : parentEntries)
      {
         names[index++] = pname;
      }
      names[index] = new QPathEntry(name.getNamespace(), name.getName(), itemIndex);

      QPath path = new QPath(names);
      return path;
   }
413336
public static String formatPath(List<ChildNumber> path) {
        return PATH_JOINER.join(Iterables.concat(Collections.singleton("M"), path));
    }
1324241
@Override
    public Path relativize(final Path other) {
        if (other == null) {
            throw new IllegalArgumentException("other path must be specified");
        }
        if (!(other instanceof ShrinkWrapPath)) {
            throw new IllegalArgumentException("Can only relativize paths of type "
                + ShrinkWrapPath.class.getSimpleName());
        }

        // Equal paths, return empty Path
        if (this.equals(other)) {
            return new ShrinkWrapPath("", this.fileSystem);
        }

        // Recursive relativization
        final Path newPath = relativizeCommonRoot(this, this, other, other, 0);
        return newPath;
    }
1033173
private static String mergePaths(String path1, String path2)
  {
    return path1 + (path1.endsWith(Path.SEPARATOR) ? "" : Path.SEPARATOR) + path2;
  }
262760
@SuppressWarnings("unchecked")
    public static <T> List<T> concat(final Iterable<T> first, final Iterable<T> ... other) {
        List<T> list = newArrayList(first);
        for (Iterable<T> iter : other) {
            list.addAll(newArrayList(iter));
        }
        return list;
    }