public void componentChanged(AdvancedChangeEvent event) {
    for (FormalDefinitionComponent comp : this.getComponents()) {
      if (!event.comesFrom(comp.getClass())) continue;

      if (comp instanceof Alphabet) {
        switch (event.getType()) {
          case ITEM_REMOVED:
            this.purgeOfSymbols((Alphabet) comp, (Collection<Symbol>) event.getArg(0));
            return;
          case ITEM_MODIFIED:
            Symbol from = (Symbol) event.getArg(0);
            Symbol to = (Symbol) event.getArg(1);
            applySymbolMod(from.getString(), to.getString());
        }
      }

      if (comp instanceof UsesSymbols) {
        updateAlphabets(event.getType());
        return;
      }
    }
  }
 public <T extends FormalDefinitionComponent> T getComponentOfClass(Class<T> clz) {
   for (FormalDefinitionComponent comp : this.getComponents()) {
     if (clz.isAssignableFrom(comp.getClass())) return clz.cast(comp);
   }
   return null;
 }