TreeHashResult (AbstractTreeHasher treeHasher, FragmentsCollector callBack, List<? extends PsiElement> statements, PsiFragment upper, NodeSpecificHasher hasher) { final int statementsSize = statements.size(); if (statementsSize > 0) { final PsiFragment fragment = treeHasher.buildFragment(hasher, statements, 0, statementsSize - 1); fragment.setParent(upper); int cost = 0; int hash = 0; for (PsiElement statement : statements) { final TreeHashResult res = treeHasher.hash(statement, null, hasher); hash = hash* 31 + res.getHash(); cost += res.getCost(); } TreeHashResult result = new TreeHashResult(hash, cost, treeHasher.buildFragment(hasher, statements, 0, statementsSize - 1)); if (callBack != null && statementsSize > 1) callBack.add(hash, cost, fragment); return result; } return new TreeHashResult(1, 0, treeHasher.buildFragment(hasher, statements, 0, statementsSize - 1)); }