mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
tree construction improvement
This commit is contained in:
@@ -30,6 +30,11 @@ public class Tree {
|
||||
private TreeConnectionType connectionType;
|
||||
private TreeLeaf leaf;
|
||||
|
||||
public Tree(TreeConnectionType connectionType) {
|
||||
this.children = new ArrayList<Tree>();
|
||||
this.connectionType = connectionType;
|
||||
}
|
||||
|
||||
public Tree(TreeLeaf leaf) {
|
||||
this.leaf = leaf;
|
||||
}
|
||||
@@ -43,9 +48,13 @@ public class Tree {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void trimChildren(int count) {
|
||||
public void trimChildrenLeft(int count) {
|
||||
children = children.subList(count, children.size());
|
||||
}
|
||||
|
||||
public void trimChildrenRight(int count) {
|
||||
children = children.subList(0, children.size() - count);
|
||||
}
|
||||
|
||||
public TreeConnectionType getConnectionType() {
|
||||
return connectionType;
|
||||
|
||||
@@ -92,7 +92,10 @@ public class TreeLeaf implements ITree {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return component.getName() + "." + component.getInternalLinkName(pointIndex1, pointIndex2);
|
||||
String linkName = component.getInternalLinkName(pointIndex1, pointIndex2);
|
||||
if (component.getName().equals(linkName))
|
||||
return linkName;
|
||||
return component.getName() + "." + linkName;
|
||||
}
|
||||
|
||||
public String toHTML() {
|
||||
|
||||
Reference in New Issue
Block a user