createTree(1, orgNodeTree, sameOrgNodes, 0);@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class NodeTree {
private String pName;
private String name;
private int level;
private List<NodeTree> children;
}
private void createTree(int leave, int ind, Map<String, NodeTree> pIndexNodeNameMap, List<NodeVo> childNodes) {
Map<String, NodeTree> cIndexNodeNameMap = new HashMap();
//構(gòu)建樹
int treeNo = pIndexNodeNameMap.size();
if (treeNo == 0) {
return;
}
int group = 0;
for (int i = ind; i < childNodes.size(); i++) {
NodeVo node = childNodes.get(i);
long index = node.getId() % treeNo;
NodeTree pNode = pIndexNodeNameMap.get(index + "");
List<NodeTree> children = pNode.getChildren();
if (CollectionUtils.isEmpty(children)) {
children = new ArrayList();
}
if (children.size() > 2) {
leave++;
createTree(leave, i, cIndexNodeNameMap, childNodes);
break;
} else {
NodeTree child = new NodeTree();
child.setLevel(leave);
child.setPName(pNode.getName());
child.setName(node.getNodeName());
children.add(child);
pNode.setChildren(children);
cIndexNodeNameMap.put(group + "", child);
group++;
}
}
}private boolean createTree(int level, List<NodeTree> parentNodes, List<NodeVo> childNodes, int beginIndex) {
//構(gòu)建樹
List<NodeTree> nextLevelNodes = new ArrayList<>();
for (int i = beginIndex; i < childNodes.size(); i++) {
int parentCount = 1;
for (NodeTree pNode : parentNodes) {
List<NodeTree> children = pNode.getChildren();
if (CollectionUtils.isEmpty(children)) {
children = new ArrayList();
pNode.setChildren(children);
}
if (children.size() >= 3) {
if(parentCount >= parentNodes.size()){
return createTree(++level, nextLevelNodes, childNodes, beginIndex);
}
} else {
if (beginIndex >= childNodes.size()) {
return true;
}
NodeTree child = new NodeTree();
child.setLevel(level);
child.setPName(pNode.getName());
NodeVo node = childNodes.get(beginIndex);
child.setName(node.getNodeName());
pNode.getChildren().add(child);
nextLevelNodes.add(child);
beginIndex++;
}
parentCount++;
}
}
return true;
}
2018年5月20日 #
執(zhí)行命名:
git pull github master --allow-unrelated-histories
執(zhí)行結(jié)果如下:
git pull github master --allow-unrelated-histories
執(zhí)行結(jié)果如下:
E:\WorkSpace\workspaceJ2ee\abocode\jfaster>git pull github master --allow-unrelated-histories
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 3
Unpacking objects: 100% (3/3), done.
From https://github.com/abocode/jfaster
* branch master -> FETCH_HEAD
* [new branch] master -> github/master
Merge made by the 'recursive' strategy.
.gitattributes | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 .gitattributes
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 3
Unpacking objects: 100% (3/3), done.
From https://github.com/abocode/jfaster
* branch master -> FETCH_HEAD
* [new branch] master -> github/master
Merge made by the 'recursive' strategy.
.gitattributes | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 .gitattributes
進(jìn)入“控制面板”——“用戶賬戶”-憑據(jù)管理器——windows憑據(jù)
找到了git的用戶名密碼。修改正確后ok