传入一个term 返回这个term的状态

@param branch
@param term
@return
515225
private SmartForest<String[]> termStatus(SmartForest<String[]> branch, Term term) {
        String name = term.getName();
        SmartForest<String[]> sf = branch;
        for (int j = 0; j < name.length(); j++) {
            sf = sf.get(name.charAt(j));
            if (sf == null) {
                return null;
            }
        }
        return sf;
    }
419040
def for_branch(self, branch):
        
        return self.replace(course_key=self.course_key.for_branch(branch))
1212047
public void walkPath(Map<String, Double> relationMap) {
        Term term = null;
        // BEGIN先行打分
        merger(root, 0, relationMap);
        // 从第一个词开始往后打分
        for (int i = 0; i < terms.length; i++) {
            term = terms[i];
            while (term != null && term.from() != null && term != end) {
                int to = term.toValue();
                merger(term, to, relationMap);
                term = term.next();
            }
        }
        optimalRoot();
    }
1154232
private List<WComponent> getComponentsForTerm(final String term) {
		List<WComponent> childList = content.getComponentModel().getChildren();
		List<WComponent> result = new ArrayList<>();

		if (childList != null) {
			for (int i = 0; i < childList.size(); i++) {
				WComponent child = childList.get(i);

				if (term.equals(child.getTag())) {
					result.add(child);
				}
			}
		}

		return result;
	}
1264017
private void buildNode(Node parent, List<String>[] sequence, int from, List<Node> leaf){
        //递归退出条件：二维数组遍历完毕
        if(from >= sequence.length){
            //记住叶子节点
            leaf.add(parent);
            return;
        }
        for(String item : sequence[from]){
            Node child = new Node(item, parent);
            buildNode(child, sequence, from+item.length(), leaf);
        }
    }
225660
def branch_type(cls, branch):
        
        typename = branch.GetClassName()
        if not typename:
            leaf = branch.GetListOfLeaves()[0]
            typename = leaf.GetTypeName()
            # check if leaf has multiple elements
            leaf_count = leaf.GetLeafCount()
            if leaf_count:
                length = leaf_count.GetMaximum()
            else:
                length = leaf.GetLen()
            if length > 1:
                typename = '{0}[{1:d}]'.format(typename, length)
        return typename
446067
function addWord(word) {

    var branch = this.root;
    var stopSearchOnCurrentBranch = false;
    var newNode;

    while (!stopSearchOnCurrentBranch) {
      var wordContainsThePrefix = false;
      var isCase3 = false;
      var case2Result;

      //Looks for how branch it should follow
      for (var b in branch.branches) {

        //Case 1: current node prefix == `word`
        if(this._tryCase1(branch, word, b)) {
          return;
        }

        //Case 2: `word` begins with current node prefix to add
        //Cuts the word and goes to the next branch
        case2Result = this._tryCase2(branch, word, b);
        if(case2Result) {
          word = case2Result.word;
          branch = case2Result.branch;
          wordContainsThePrefix = true;
          break;
        }

        //Case 3: current node prefix begins with part of or whole `word`
        if(this._tryCase3(branch, word, b)) {
          isCase3 = stopSearchOnCurrentBranch = wordContainsThePrefix = true;
          break;
        }
      }

      //Case 4: current node prefix doesn't have intersection with `word`
      if(this._tryCase4(branch, word, wordContainsThePrefix)) {
        stopSearchOnCurrentBranch = true;
      }
    }
  }
1096949
public FieldSpec buildConditionField(int index, Struct<PluralType> branch) {
    String fieldDoc = PluralRulePrinter.print(branch);
    String name = String.format("COND_%d", index);
    FieldSpec.Builder field = FieldSpec.builder(PLURAL_CONDITION, name, PRIVATE, STATIC, FINAL)
        .addJavadoc(fieldDoc + "\n");

    List<Node<PluralType>> expressions = branch.nodes();

    CodeBlock.Builder code = CodeBlock.builder();
    code.beginControlFlow("(o) ->");

    int size = expressions.size();
    for (int i = 0; i < size; i++) {
      renderExpr(i == 0, code, expressions.get(i));
    }
    code.addStatement("return true");
    code.endControlFlow();

    field.initializer(code.build());
    return field.build();
  }
397407
public void remove(String key)
    {
        BaseNode branch = this;
        char[] chars = key.toCharArray();
        for (int i = 0; i < chars.length - 1; ++i)
        {
            if (branch == null) return;
            branch = branch.getChild(chars[i]);
        }
        if (branch == null) return;
        // 最后一个字设为undefined
        if (branch.addChild(new Node(chars[chars.length - 1], Status.UNDEFINED_0, value)))
        {
            --size;
        }
    }
525688
public ImmutableTerm convertIntoImmutableTerm(Term term) {
        if (term instanceof Function) {
            if (term instanceof Expression) {
                Expression expression = (Expression) term;
                return termFactory.getImmutableExpression(expression);
            } else {
                Function functionalTerm = (Function) term;

                if (functionalTerm.getFunctionSymbol() instanceof FunctionSymbol)
                    return termFactory.getImmutableFunctionalTerm(
                            (FunctionSymbol) functionalTerm.getFunctionSymbol(),
                            convertTerms(functionalTerm));
                else
                    throw new NotAFunctionSymbolException(term + " is not using a FunctionSymbol but a "
                            + functionalTerm.getFunctionSymbol().getClass());
            }
        }
        /*
         * Other terms (constant and variable) are immutable.
         */
        return (ImmutableTerm) term;
    }
1211967
public static void parseNature(Term term) {
		if (!Nature.NW.equals(term.natrue())) {
			return;
		}

		String name = term.getName();

		if (name.length() <= 3) {
			return;
		}

		// 是否是外国人名
		if (DATDictionary.foreign(term)) {
			term.setNature(NatureLibrary.getNature("nrf"));
			return;
		}

		List<Term> subTerm = term.getSubTerm();

		// TODO:判断是否是机构名

	}
103970
public Term removeTerm(String name) {
        Iterator<Term> it = this.terms.iterator();
        while (it.hasNext()) {
            Term term = it.next();
            if (term.getName().equals(name)) {
                it.remove();
                return term;
            }
        }
        return null;
    }
1020087
@Override
    public void recognition(Term[] terms) {
        int length = terms.length - 1;
        Term from = null;
        Term to = null;
        Term temp = null;
        for (int i = 0; i < length; i++) {
            if (terms[i] == null) {
                continue;
            } else if (".".equals(terms[i].getName()) || "．".equals(terms[i].getName())) {
                // 如果是.前后都为数字进行特殊处理
                to = terms[i].to();
                from = terms[i].from();
                if (from.termNatures().numAttr.flag && to.termNatures().numAttr.flag) {
                    from.setName(from.getName() + "." + to.getName());
                    TermUtil.termLink(from, to.to());
                    terms[to.getOffe()] = null;
                    terms[i] = null;
                    i = from.getOffe() - 1;
                }
                continue;
            } else if (!terms[i].termNatures().numAttr.flag) {
                continue;
            }

            temp = terms[i];
            // 将所有的数字合并
            while ((temp = temp.to()).termNatures().numAttr.flag) {
                terms[i].setName(terms[i].getName() + temp.getName());
            }
            // 如果是数字结尾
            if (MyStaticValue.isQuantifierRecognition && temp.termNatures().numAttr.numEndFreq > 0) {
                terms[i].setName(terms[i].getName() + temp.getName());
                temp = temp.to();
            }

            // 如果不等,说明terms[i]发生了改变
            if (terms[i].to() != temp) {
                TermUtil.termLink(terms[i], temp);
                // 将中间无用元素设置为null
                for (int j = i + 1; j < temp.getOffe(); j++) {
                    terms[j] = null;
                }
                i = temp.getOffe() - 1;
            }
        }

    }
660612
@Override
  public Terms terms(String field) throws IOException {
    return new MtasTerms(delegateFieldsProducer.terms(field), indexInputList,
        indexInputOffsetList, version);
  }
790421
public static void insertTerm(Term[] terms, Term term, InsertTermType type) {
        Term self = terms[term.getOffe()];

        if (self == null) {
            terms[term.getOffe()] = term;
            return;
        }

        int len = term.getName().length();

        // 如果是第一位置
        if (self.getName().length() == len) {
            if (type == InsertTermType.REPLACE) {
                term.setNext(self.next());
                terms[term.getOffe()] = term;
            } else if (type == InsertTermType.SCORE_ADD_SORT) {
                self.score(self.score() + term.score());
                self.selfScore(self.selfScore() + term.selfScore());
            }
            return;
        }

        if (self.getName().length() > len) {
            term.setNext(self);
            terms[term.getOffe()] = term;
            return;
        }

        Term next = self;
        Term before = self;
        while ((next = before.next()) != null) {
            if (next.getName().length() == len) {
                if (type == InsertTermType.REPLACE) {
                    term.setNext(next.next());
                    before.setNext(term);
                } else if (type == InsertTermType.SCORE_ADD_SORT) {
                    next.score(next.score() + term.score());
                    next.selfScore(next.selfScore() + term.selfScore());
                }
                return;
            } else if (next.getName().length() > len) {
                before.setNext(term);
                term.setNext(next);
                return;
            }
            before = next;
        }

        before.setNext(term); // 如果都没有命中
    }
638594
public void sparseCheckout(String branch, String path) throws Exception {
        fetch(); // in case the branch is not known locally
        hardReset();
        checkout(branch);
        pull(branch);  // pull before delete or next pull may add non-path items back

        // delete non-path items
        List<File> preserveList = new ArrayList<File>();
        preserveList.add(new File(localDir + "/.git"));
        preserveList.add(new File(localDir + "/" + path));
        new Delete(localDir, true).run();
    }
954619
protected String branchRefForName( String branchName ) {
        String remoteName = connector.remoteName();
        return remoteName != null ? remoteBranchPrefix(remoteName) + branchName : LOCAL_BRANCH_PREFIX + branchName;
    }