mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
detect volume and tone pots
This commit is contained in:
@@ -247,6 +247,9 @@ public class Tree {
|
||||
if (p1 == null || p2 == null)
|
||||
return null;
|
||||
|
||||
if (p1 == p2)
|
||||
return p1;
|
||||
|
||||
if (p1 != p2)
|
||||
return this;
|
||||
|
||||
@@ -272,6 +275,20 @@ public class Tree {
|
||||
return findCommonParent(t.get(0), findCommonParent(remainder));
|
||||
}
|
||||
|
||||
public Tree findParent(Tree t) {
|
||||
if (children == null)
|
||||
return null;
|
||||
if (children.contains(t))
|
||||
return this;
|
||||
for (Tree c : children)
|
||||
{
|
||||
Tree p = c.findParent(t);
|
||||
if (p != null)
|
||||
return p;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean contains(Tree t) {
|
||||
if (this == t)
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user