public HeatBehaviour getBehaviourForId(String id) {
   HeatBehaviour behaviour = behaviours.get(id);
   if (behaviour != null) {
     try {
       return behaviour.getClass().newInstance();
     } catch (Exception e) {
       e.printStackTrace();
       return null;
     }
   } else {
     Log.warning("No heat behaviour found for id: " + id);
     return null;
   }
 }
 public void addHeatBehaviours(
     World world, int x, int y, int z, IHeatExchangerLogic logic, List<HeatBehaviour> list) {
   for (HeatBehaviour behaviour : behaviours.values()) {
     behaviour.initialize(logic, world, x, y, z);
     if (behaviour.isApplicable()) {
       try {
         behaviour = behaviour.getClass().newInstance();
         behaviour.initialize(logic, world, x, y, z);
         list.add(behaviour);
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }
 }
 public void registerBehaviour(Class<? extends HeatBehaviour> behaviour) {
   if (behaviour == null) throw new IllegalArgumentException("Can't register a null behaviour!");
   try {
     HeatBehaviour ins = behaviour.newInstance();
     HeatBehaviour overridenBehaviour = behaviours.put(ins.getId(), ins);
     if (overridenBehaviour != null)
       Log.warning(
           "Registered a heat behaviour that has the same id as an already registered one. The old one will be discarded. Old behaviour class: "
               + overridenBehaviour.getClass()
               + ". New class: "
               + behaviour.getClass());
   } catch (InstantiationException e) {
     throw new IllegalArgumentException(
         "The behaviour class doesn't have a nullary constructor, or is abstract! Class: "
             + behaviour);
   } catch (IllegalAccessException e) {
     throw new IllegalArgumentException(
         "Doesn't have access to the class (is it private?) Class: " + behaviour);
   }
 }