/**
   * Removes a model of a specific type
   *
   * @param furnitureTypeName The name of the type of furniture the model belongs to
   * @param name The name of the model
   */
  public void rm(String furnitureTypeName, String name) {
    FurnitureType furnitureType = getForWrite(furnitureTypeName);

    furnitureType.removeFurnitureModel(name);

    notify(new FMSetModifiedEvent(furnitureTypeName, name, false));
  }
Example #2
0
  public Set<Functionality> getUnsatisfiedFunctionalities(
      NamedCatalog<FurnitureType> typesCatalog) {
    Set<Functionality> notSatisfied = room.getNeededFunctions();

    for (String elementType : furniture.getTypeNames()) {
      FurnitureType type = typesCatalog.get(elementType);

      for (Functionality function : type.getFunctionalities()) notSatisfied.remove(function);
    }

    return notSatisfied;
  }
  /**
   * Adds a furniture model of a certain type to the furniture catalog
   *
   * @param furnitureTypeName The name of the type of furniture
   * @param name The name of the model
   * @param width The width of the specific model
   * @param depth The depth of the specific model
   * @param price The price the model costs
   * @param color The color of the specific model
   * @param material The material the specific model is made from
   * @param passiveOffsets The cardinal offsets (N,E,S,W) of the passive space the furniture should
   *     hold by default
   */
  public void add(
      String furnitureTypeName,
      String name,
      int width,
      int depth,
      float price,
      String color,
      String material,
      int[] passiveOffsets) {
    FurnitureType furnitureType = getForWrite(furnitureTypeName);

    Dimension size = new Dimension(width, depth);
    SpaceAround passiveSpace =
        new SpaceAround(passiveOffsets[0], passiveOffsets[1], passiveOffsets[2], passiveOffsets[3]);

    FurnitureModel furnitureModel =
        new FurnitureModel(name, size, price, color, material, passiveSpace);

    furnitureType.addFurnitureModel(furnitureModel);

    notify(new FMSetModifiedEvent(furnitureTypeName, name, true));
  }
  /**
   * Gets all the models of a certain type
   *
   * @param furnitureTypeName The name of the type of furniture
   * @return A collection of furniture models
   */
  public Collection<FurnitureModel> getFurnitureModels(String furnitureTypeName) {
    FurnitureType furnitureType = get(furnitureTypeName);

    return furnitureType.getFurnitureModels();
  }