// Add a path and its associated value to the tree.
//   - key must begin with "/"
//   - key must not duplicate any existing key.
// Returns an error if those conditions do not hold.
502588
func (n *Node) Add(key string, val interface{}) error {
	if key == "" || key[0] != '/' {
		return errors.New("Path must begin with /")
	}
	n.leafs++
	return n.add(n.leafs, splitPath(key), nil, val)
}
64349
func (l *OSFileSystemLoader) AddPath(path string) {
	l.dirs = append(l.dirs, path)
}
1214833
func (a *BucketSelectorAggregation) AddBucketsPath(name, path string) *BucketSelectorAggregation {
	if a.bucketsPathsMap == nil {
		a.bucketsPathsMap = make(map[string]string)
	}
	a.bucketsPathsMap[name] = path
	return a
}
162709
func AddPrefix(path string) string {
	if !strings.HasPrefix(path, Prefix) {
		path = Prefix + path
	}
	return path
}
1087263
func (k *key) Path() path.Path {
	return path.New(ipfspath.Join([]string{"/ipns", k.peerID.Pretty()}))
}
1307551
func (e *Entry) Path() string {
	if e.Parent == nil {
		return ""
	}

	var p []string

	for e != nil && e.Parent != nil {
		p = append(p, e.Name)
		e = e.Parent
	}

	l := len(p) / 2
	for i := 0; i < l; i++ {
		j := len(p) - i - 1
		p[i], p[j] = p[j], p[i]
	}

	return strings.Join(p, "/")
}
477472
func (args Args) Add(key, value string) {
	if _, ok := args.fields[key]; ok {
		args.fields[key][value] = true
	} else {
		args.fields[key] = map[string]bool{value: true}
	}
}
245749
func (r *Router) Add(method string, path string, handler HandlerFunc) {
	_logger.debug("===Add")
	if len(path) == 0 {
		panic("router: path couldn't be empty")
	}
	if path[0] != '/' {
		panic("router: path was invalid")
	}
	if len(path) > 1 {
		path = path[1:]
	}
	_logger.debug("path:" + path)

	currentNode := r.tree.rootNode
	if path == "/" {
		currentNode.addHandler(method, handler)
		return
	}

	pathArray := strings.Split(path, "/")
	count := len(pathArray)
	pathParams := []string{}

	for index, element := range pathArray {
		if len(element) == 0 {
			continue
		}

		var childNode *node
		firstSymbol := element[0]
		if firstSymbol == ':' {
			// this is parameter node
			pName := element[1:]
			_logger.debug("parameter_node_pname:" + pName)
			childNode = currentNode.findChildByKind(pkind)
			if childNode == nil {
				childNode = newNode(pName, pkind)
				currentNode.addChild(childNode)
			}

			isFound := false
			for _, p := range childNode.pNames {
				if p == pName {
					isFound = true
				}
			}

			if isFound == false {
				childNode.pNames = append(childNode.pNames, pName)
				_logger.debug("add_parameter_name:" + pName)
			}

			pathParams = append(pathParams, pName)

		} else if firstSymbol == '*' {
			// this is match any node.  We should allow one match any node only.
			pName := element[1:]
			_logger.debug("match_node_pname:" + pName)
			childNode = currentNode.findChildByKind(akind)
			if childNode == nil {
				childNode = newNode(pName, akind)
				currentNode.addChild(childNode)
				childNode.pNames = append(childNode.pNames, pName)
			}

			pathParams = append(pathParams, pName)

		} else {
			// this is static node
			childNode = currentNode.findChildByName(element)
			if childNode == nil {
				childNode = newNode(element, skind)
				currentNode.addChild(childNode)
			}
		}

		// last node in the path
		if count == index+1 {
			childNode.params = pathParams
			childNode.addHandler(method, handler)
		}

		currentNode = childNode
	}

}
682545
func (node *Node) PathToLeaf(t *ImmutableTree, key []byte) (PathToLeaf, *Node, error) {
	path := new(PathToLeaf)
	val, err := node.pathToLeaf(t, key, path)
	return *path, val, err
}
578140
func (p *PathManager) AddPaths(paths []string) {
	p.l.Lock()
	defer p.l.Unlock()

	txn := p.paths.Txn()
	for _, prefix := range paths {
		if len(prefix) == 0 {
			continue
		}

		var exception bool
		if strings.HasPrefix(prefix, "!") {
			prefix = strings.TrimPrefix(prefix, "!")
			exception = true
		}

		// We trim any trailing *, but we don't touch whether it is a trailing
		// slash or not since we want to be able to ignore prefixes that fully
		// specify a file
		txn.Insert([]byte(strings.TrimSuffix(prefix, "*")), exception)
	}
	p.paths = txn.Commit()
}
401088
func (m *nodeMap) add(node *Node) (string, *Node, error) {
	key := node.Address()

	m.Lock()
	m.nodes[node.Address()] = node
	m.Unlock()

	return key, node, nil
}
1235347
func (t *TermsLookup) Path(path string) *TermsLookup {
	t.path = path
	return t
}
909878
func (t *Tree) HasPath(keys []string) bool {
	return t.GetPath(keys) != nil
}
591031
func (t *Tree) Add(path string, node Node) {
	path = pathpkg.Clean("/" + path)[1:]
	elems := strings.Split(path, "/")
	dir := Node(&t.tree)
	for i, elem := range elems {
		dt, ok := dir.(*tree)
		if !ok {
			panic("fuse: Tree.Add for " + strings.Join(elems[:i], "/") + " and " + path)
		}
		n := dt.lookup(elem)
		if n != nil {
			if i+1 == len(elems) {
				panic("fuse: Tree.Add for " + path + " conflicts with " + elem)
			}
			dir = n
		} else {
			if i+1 == len(elems) {
				dt.add(elem, node)
			} else {
				dir = &tree{}
				dt.add(elem, dir)
			}
		}
	}
}
3361
func appendPath(base string, path string) string {
	// if path starts with `/` shave it off
	if path[0] == '/' {
		path = path[1:]
	}
	return base + path
}
271024
func (k Key) Path() Key {
	s := k.Parent().string + "/" + NamespaceType(k.BaseNamespace())
	return NewKey(s)
}
190768
func appendPath(rootPath, childPath string) string {
	return strings.TrimRight(rootPath, "/") + "/" + strings.TrimLeft(childPath, "/")
}