The default ordering for paths is such that it will produce a
post-traversal ordering. All relative paths will be before absolute paths
which are before external paths.
161239
public int compareTo(Path o) {

        // Sanity check.
        if (o == null) {
            throw new NullPointerException();
        }

        // If these are not the same type, do the simple comparison.
        if (this.type != o.type) {
            return type.compareTo(o.type);
        }

        // Same type of path, so check first the number of terms. If not equal,
        // then it is easy to decide the order. (Longer paths come before
        // shorter ones.)
        int mySize = this.terms.length;
        int otherSize = o.terms.length;
        if (mySize != otherSize) {
            return (mySize < otherSize) ? 1 : -1;
        }

        // Ok, the hard case, the two paths are of the same type and have the
        // same number of terms.
        for (int i = 0; i < mySize; i++) {
            Term myTerm = this.terms[i];
            Term otherTerm = o.terms[i];
            int comparison = myTerm.compareTo(otherTerm);
            if (comparison != 0) {
                return comparison;
            }
        }

        // We've gone through all of the checks, so the two paths must be equal;
        // return zero.
        return 0;
    }
554429
private boolean checkFileLevelRelativeToRoot(Path filePath, int depth) {
    if (filePath == null) {
      return false;
    }
    Path path = filePath;
    for (int i = 0; i < depth - 1; i++) {
      path = path.getParent();
    }
    if (!path.getName().equals(folderName)) {
      return false;
    }
    return true;
  }
723690
function orderNodes(ast) {
  var comments  = Array.isArray(ast.comments) ? ast.comments.slice() : [];
  var comparitor = ('sortIndex' in ast) ? compareIndex : compareLocation;
  return comments
    .concat(depthFirst(ast, ast.parent))
    .sort(comparitor)
    .map(setSortIndex);
}
836351
function createPath(root, item) {
        var paths = item.parent.split('/'),
            dir, prevEl, el;

        if (paths && paths.length) {
            paths.forEach(function (path, index) {
                dir = paths.slice(0, index + 1).join('/');
                el = root.find(dir);

                if (!el) {
                    el = et.SubElement(prevEl ? prevEl : root, path, {});
                }

                prevEl = el;
            });
        }

        return root.find(item.parent || root.find('*/' + item.parent));
    }
1096202
function routeFromRel (route, rel) {
    // if rel is empty string then this is route
    if (rel.length === 0) {
        // set root flag on route
        route.root = true
        // return route
        return route
    }
    // if rel is above root this is error
    assert.ok(!rel.match(/^\./), 'relative path above app root: '+rel)
    // split rel into directories
    var dirs = rel.split('/')
    // get next route node for each dir in rel path
    _.each(dirs, dir => {
        // create sub node if it does not exists
        if (!route.routes) {
            route.routes = {}
        }
        // create new entry for dir if it does not exist
        if (!route.routes[dir]) {
            route.routes[dir] = {}
        }
        // switch context
        route = route.routes[dir]
    })
    // return resolved route
    return route
}
929587
public boolean nextInOrder() {
        if (mNode == null) {
            return false;
        }
        if (firstChild()) {
            return true;
        }
        if (nextSibling()) {
            return true;
        }
        AccessibilityNodeInfoRef tmp = unOwned(mNode);
        while (tmp.parent()) {
            if (tmp.nextSibling()) {
                reset(tmp);
                return true;
            }
        }
        tmp.clear();
        return false;
    }
955247
function absAliasPaths(alias) {
    return Object.keys(alias).reduce( (prev, key) => {
        prev[key] = alias[key].split(path.sep)
            .filter(item => !!item)
            .reduce((prev, item) => path.resolve(prev, item),  path.sep);
        return prev;
    }, {});
}
411746
function toReturn(path) {
    const { node } = path;

    if (
      !path.getSibling(path.key + 1).node &&
      path.parentPath &&
      path.parentPath.parentPath &&
      path.parentPath.parentPath.isFunction()
    ) {
      // Only the consequent is a return, void the alternate.
      if (
        t.isReturnStatement(node.consequent) &&
        t.isExpressionStatement(node.alternate)
      ) {
        if (!node.consequent.argument) {
          path.replaceWith(
            t.expressionStatement(
              t.logicalExpression("||", node.test, node.alternate.expression)
            )
          );
          return REPLACED;
        }

        path.replaceWith(
          t.returnStatement(
            t.conditionalExpression(
              node.test,
              node.consequent.argument || h.VOID_0(t),
              t.unaryExpression("void", node.alternate.expression, true)
            )
          )
        );
        return REPLACED;
      }

      // Only the alternate is a return, void the consequent.
      if (
        t.isReturnStatement(node.alternate) &&
        t.isExpressionStatement(node.consequent)
      ) {
        if (!node.alternate.argument) {
          path.replaceWith(
            t.expressionStatement(
              t.logicalExpression("&&", node.test, node.consequent.expression)
            )
          );
          return REPLACED;
        }

        path.replaceWith(
          t.returnStatement(
            t.conditionalExpression(
              node.test,
              t.unaryExpression("void", node.consequent.expression, true),
              node.alternate.argument || h.VOID_0(t)
            )
          )
        );
        return REPLACED;
      }

      if (t.isReturnStatement(node.consequent) && !node.alternate) {
        if (!node.consequent.argument) {
          path.replaceWith(t.expressionStatement(node.test));
          return REPLACED;
        }

        // This would only be worth it if the previous statement was an if
        // because then we may merge to create a conditional.
        if (path.getSibling(path.key - 1).isIfStatement()) {
          path.replaceWith(
            t.returnStatement(
              t.conditionalExpression(
                node.test,
                node.consequent.argument || h.VOID_0(t),
                h.VOID_0(t)
              )
            )
          );
          return REPLACED;
        }
      }

      if (t.isReturnStatement(node.alternate) && !node.consequent) {
        if (!node.alternate.argument) {
          path.replaceWith(t.expressionStatement(node.test));
          return REPLACED;
        }

        // Same as above.
        if (path.getSibling(path.key - 1).isIfStatement()) {
          path.replaceWith(
            t.returnStatement(
              t.conditionalExpression(
                node.test,
                node.alternate.argument || h.VOID_0(t),
                h.VOID_0(t)
              )
            )
          );
          return REPLACED;
        }
      }
    }

    let next = path.getSibling(path.key + 1);

    // If the next satatement(s) is an if statement and we can simplify that
    // to potentailly be an expression (or a return) then this will make it
    // easier merge.
    if (next.isIfStatement()) {
      next.pushContext(path.context);
      next.visit();
      next.popContext();
      next = path.getSibling(path.key + 1);
    }

    // Some other visitor might have deleted our node. OUR NODE ;_;
    if (!path.node) {
      return;
    }

    // No alternate but the next statement is a return
    // also turn into a return conditional
    if (
      t.isReturnStatement(node.consequent) &&
      !node.alternate &&
      next.isReturnStatement()
    ) {
      const nextArg = next.node.argument || h.VOID_0(t);
      next.remove();
      path.replaceWith(
        t.returnStatement(
          t.conditionalExpression(
            node.test,
            node.consequent.argument || h.VOID_0(t),
            nextArg
          )
        )
      );
      return REPLACED;
    }

    // Next is the last expression, turn into a return while void'ing the exprs
    if (
      path.parentPath &&
      path.parentPath.parentPath &&
      path.parentPath.parentPath.isFunction() &&
      !path.getSibling(path.key + 2).node &&
      t.isReturnStatement(node.consequent) &&
      !node.alternate &&
      next.isExpressionStatement()
    ) {
      const nextExpr = next.node.expression;
      next.remove();

      if (node.consequent.argument) {
        path.replaceWith(
          t.returnStatement(
            t.conditionalExpression(
              node.test,
              node.consequent.argument,
              t.unaryExpression("void", nextExpr, true)
            )
          )
        );
        return REPLACED;
      }

      path.replaceWith(t.logicalExpression("||", node.test, nextExpr));
      return REPLACED;
    }
  }
1129650
function (path) {
        if (path && path.match(/^data:(.*?)base64,/)) {
            return path;
        }

        var rootPath = this.bufferRootPath;
        if (rootPath == null) {
            rootPath = this.rootPath;
        }
        return util$1.relative2absolute(path, rootPath);
    }
17399
public boolean nextPath() {
		// post-increment
		m_currentPathIndex = m_nextPathIndex;
		if (m_currentPathIndex >= m_parent.getPathCount())
			return false;

		m_currentSegmentIndex = -1;
		m_nextSegmentIndex = 0;
		m_segmentCount = _getSegmentCount(m_currentPathIndex);
		m_pathBegin = m_parent.getPathStart(m_currentPathIndex);
		m_nextPathIndex++;
		return true;
	}
1165705
public void setFocusTraversalOrder( int traversalOrder ) {
        Assert.isTrue( traversalOrder == COLUMN_MAJOR_FOCUS_ORDER || traversalOrder == ROW_MAJOR_FOCUS_ORDER,
            "traversalOrder must be one of COLUMN_MAJOR_FOCUS_ORDER or ROW_MAJOR_FOCUS_ORDER");

        List focusOrder = new ArrayList(items.size());

        if( traversalOrder == ROW_MAJOR_FOCUS_ORDER ) {
            for( int row=0; row < rowOccupiers.size() - 1; row++ ) {
                for( int col=0; col < maxColumns; col++ ) {
                    Cell currentCell = getOccupier(row, col);
                    if (currentCell != null && currentCell.getComponent() != null && !focusOrder.contains(currentCell.getComponent())) {
                        focusOrder.add(currentCell.getComponent());
                    }
                }
            }
        } else if( traversalOrder == COLUMN_MAJOR_FOCUS_ORDER ) {
            for( int col = 0; col < maxColumns; col++ ) {
                for( int row = 0; row < rowOccupiers.size() - 1; row++ ) {
                    Cell currentCell = getOccupier( row, col );
                    if( currentCell != null && currentCell.getComponent() != null && !focusOrder.contains( currentCell.getComponent() ) ) {
                        focusOrder.add( currentCell.getComponent() );
                    }
                }
            }
        }

        setCustomFocusTraversalOrder( focusOrder );
    }
1163508
def postorder(self, skip_seed=False):
        
        for node in self._tree.postorder_node_iter():
            if skip_seed and node is self._tree.seed_node:
                continue
            yield node
680247
function findPath(g, postorderNums, v, w) {
  var vPath = [];
  var wPath = [];
  var low = Math.min(postorderNums[v].low, postorderNums[w].low);
  var lim = Math.max(postorderNums[v].lim, postorderNums[w].lim);
  var parent;
  var lca;

  // Traverse up from v to find the LCA
  parent = v;
  do {
    parent = g.parent(parent);
    vPath.push(parent);
  } while (parent &&
           (postorderNums[parent].low > low || lim > postorderNums[parent].lim));
  lca = parent;

  // Traverse from w to LCA
  parent = w;
  while ((parent = g.parent(parent)) !== lca) {
    wPath.push(parent);
  }

  return { path: vPath.concat(wPath.reverse()), lca: lca };
}
1012651
def dfs_postorder(self, reverse=False):
        """"""
        stack = deque()
        stack.append(self)
        visited = set()
        while stack:
            node = stack.pop()
            if node in visited:
                yield node
            else:
                visited.add(node)
                stack.append(node)
                if hasattr(node, "childs"):
                    if reverse:
                        stack.extend(node.childs)
                    else:
                        stack.extend(node.childs[::-1])
61495
private function initWithParentOrder($path, array $parentReferences)
    {
        foreach ($parentReferences as $parentPath => $_) {
            // Look for the first parent entry for which an order is defined
            if (isset($this->json['_order'][$parentPath])) {
                // Inherit that order
                $this->json['_order'][$path] = $this->json['_order'][$parentPath];

                return;
            }
        }
    }
1363987
public boolean inOrder() {
        SortedSet<Integer> prev = null;
        for (SortedSet<Integer> cell : cells) {
            if (prev == null) {
                prev = cell;
            } else {
                int first = cell.first();
                int last = cell.last();
                if (first > prev.first() && last > prev.last()) {
                    prev = cell;
                } else {
                    return false;
                }
            }
        }
        return true;
    }
665604
function(paths) {
			var base = Script.current(this).absolute;
			each(paths, function(item, index) {
				var path = paths[index] = URL.absolute(URL.clean(item), base);
				if (path[path.length - 1] !== '/') {
					paths[index] += '/';
				}
			});
			return paths;
		}