@SuppressWarnings("unchecked") public Set<S> descendants(){
  Set<S> perms=new HashSet<>();
  for (  S child : children) {
    perms.add(child);
    perms.addAll(child.descendants());
  }
  return perms;
}

@ SuppressWarnings ( "unchecked" ) public Set < S > descendants ( ) { Set < S > perms = new HashSet < > ( ) ; for ( S child : children ) { perms . add ( child ) ; perms . addAll ( child . descendants ( ) ) ; } return perms ; }
gets all child nodes recursively
