mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
improve tree analysis
This commit is contained in:
@@ -230,25 +230,22 @@ public class Tree {
|
|||||||
if (t1 == null)
|
if (t1 == null)
|
||||||
return t2;
|
return t2;
|
||||||
if (t2 == null)
|
if (t2 == null)
|
||||||
return t1;
|
return t1;
|
||||||
|
|
||||||
if (children == null)
|
if (children == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Tree p1 = null;
|
if (!this.contains(t1) || !this.contains(t2))
|
||||||
Tree p2 = null;
|
return null;
|
||||||
|
|
||||||
|
Tree p1 = this;
|
||||||
|
Tree p2 = this;
|
||||||
for (Tree c : children) {
|
for (Tree c : children) {
|
||||||
if (c.contains(t1))
|
if (c.contains(t1))
|
||||||
p1 = c;
|
p1 = c;
|
||||||
if (c.contains(t2))
|
if (c.contains(t2))
|
||||||
p2 = c;
|
p2 = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p1 == null || p2 == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (p1 == p2)
|
|
||||||
return p1;
|
|
||||||
|
|
||||||
if (p1 != p2)
|
if (p1 != p2)
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user