public void link(StateModel stateModel) {
    children.add(stateModel);
    stateModel.parents.add(this);

    if (stateModel.getState().isBubbling()) {
      setState(stateModel.getState());
    }
  }
 private void propagateStateToNodes(State state, List<StateModel> nodes) {
   for (StateModel stateModel : nodes) {
     stateModel.setState(state);
   }
 }