/**
   * Obtains the name of all the furniture models available for a certain type of furniture, within
   * the active catalog
   *
   * @param furnitureTypeName The type of furniture whose models we want
   * @return A collection of strings containing all the names of the particular models of
   *     'furnitureTypeName'
   */
  public Collection<String> getFurnitureModelNames(String furnitureTypeName) {
    Collection<FurnitureModel> fmodels = getFurnitureModels(furnitureTypeName);

    Collection<String> furnitureNames = new ArrayList();
    for (FurnitureModel fm : fmodels) {
      furnitureNames.add(fm.getName());
    }
    return furnitureNames;
  }
  /** Obtains a particular model as such. Used internally */
  private FurnitureModel getModel(String furnitureTypeName, String name) {
    // If the model is chached, we return it
    if (cached_fm != null
        && cached_fm.getType().equals(furnitureTypeName)
        && cached_fm.getName().equals(name)) ;
    // Else, we find it and cache it!
    else {
      boolean wasFound = false;
      for (FurnitureModel fm : getFurnitureModels(furnitureTypeName))
        if (fm.getName().equals(name)) {
          cached_fm = fm;
          wasFound = true;
          break;
        }

      if (!wasFound) throw new ElementNotFoundBusinessException(null);
    }

    return cached_fm;
  }
  /**
   * Replaces all the properties of a given furniture by new ones
   *
   * @param furnitureTypeName The type of furniture the model pertains to
   * @param name The name of the furniture model we want to modify
   * @param width A particular width
   * @param depth A particular depth
   * @param price The price the model costs
   * @param color The color the model is painted in
   * @param material The material the model is made from
   * @param passiveOffsets An array of size 4 representing N,E,S,W offsets to the passive space
   *     around the model
   */
  public void replace(
      String furnitureTypeName,
      String name,
      int width,
      int depth,
      float price,
      String color,
      String material,
      int[] passiveOffsets) {
    FurnitureModel fm = getModel(furnitureTypeName, name);
    fm.setSize(new Dimension(width, depth));
    fm.setPrice(price);
    fm.setPassiveSpace(
        new SpaceAround(
            passiveOffsets[0], passiveOffsets[1], passiveOffsets[2], passiveOffsets[3]));
    fm.setMaterial(Material.getEnum(material));
    fm.setColor(CoolColor.getEnum(color));

    notify(new FMModifiedEvent(name, furnitureTypeName));
  }