Good way to chop trees...

Hi,

I was thinking of a nice way to chop tree entities down. I want the bottom of the tree to tell all the parts of it to ‘fall’ when it is chopped down.

What do you think about the observer pattern for this?


class Tree  // Subject
{
     ArrayList<TreeEntity> observers = new ArrayList<>(); // observers

    public setState(int state) {
        this.state = state;
        notifyAllObservers();
    }
    public void attach(TreeEntity observer) {
         treeBlocks.add(observer);
    }
    public void notifyAllObservers() {
         for(TreeEntity observer : observers)
              observer.update();
   }
}

public abstract class Observer {
   protected Tree subject;
   public abstract void update();
}

public class TreeEntity extends Observer{

   public TreeEntity(Tree subject){
      this.subject = subject;
      this.subject.attach(this);
   }

   @Override
   public void update() {
       // fall, collapse or what not dependent on the state
   }
}

Thanks