Affirm | Phone | find POPUP
Anonymous User
6154
// Initial State:

//              ROOT
//          /     |    \
//         /      |     \
//       B       C        D
//    /   |            /  | \  \
//   /    |           /   |  \  \
// F      G      (POPUP)  I  J  (K)
//              /   |   \   / \
//             /    |    \  Z  Y
//            N     O    (P)


// After openPopup called:

//              ROOT
//          /     |    \
//         /      |     \
//      (B)      (C)      D
//    /   |            /  | \   \
//   /    |           /   |  \   \
// F      G       POPUP  (I)  (J) (K)
//              /   |   \
//             /    |    \
//            N     O     (P)
  1. Find POPUP, make all the sibling of POPUP to hidden
  2. Find out POPUP's parent, make all the sibling of parent to hidden
private static class DomNode {
        String id;
        boolean hidden;
        List<DomNode> children;

        public DomNode(String id, boolean hidden, List<DomNode> children) {
            this.hidden = hidden;
            this.id = id;
            this.children = children;
        }
    }
Comments (8)