public InterioresVariable getElement(String id) {
    if (furniture.containsElement(id)) return furniture.get(id);

    if (fixed.containsElement(id)) return fixed.get(id);

    throw new WantedElementNotFoundException("element", id);
  }
  public Set<String> getElementTypes() {
    Set<String> elementTypes = new TreeSet();

    elementTypes.addAll(furniture.getTypeNames());
    elementTypes.addAll(fixed.getTypeNames());

    return elementTypes;
  }
  public void removeWantedFurniture(String elementId) {
    String typeName = furniture.getElementTypeName(elementId);

    // if type is mandatory and only one is remaining...
    if (room.isMandatory(typeName) && furniture.getTypeCount(typeName) == 1)
      throw new MandatoryFurnitureException(typeName, room.getTypeName());

    furniture.get(elementId).removeBinaryConstraints();
    furniture.remove(elementId);
  }
  public VariableConfig getVariableConfig(NamedCatalog<FurnitureType> typesCatalog) {
    Set<Functionality> functionsNotSatisfied = getUnsatisfiedFunctionalities(typesCatalog);

    if (!functionsNotSatisfied.isEmpty())
      throw new RoomFunctionalitiesNotSatisfiedException(functionsNotSatisfied);

    VariableConfig variableSet =
        new VariableConfig(room.getDimension(), new ArrayList(globalConstraints.values()));

    for (WantedFixed wfixed : fixed.getAll()) variableSet.addConstant(wfixed);

    for (WantedFurniture wfurniture : furniture.getAll())
      variableSet.addVariable(wfurniture, typesCatalog.get(wfurniture.getTypeName()));

    return variableSet;
  }
  /**
   * Adds a new binary constraint.
   *
   * @param binaryConstraintClass The type of the constraint
   * @param bc The specific binary constraint to add
   * @param f1 First WantedFurniture affected by this constraint
   */
  public void addBinaryConstraint(BinaryConstraintEnd bc, String furnitureId, String elementId) {
    if (!furniture.containsElement(furnitureId))
      throw new WantedFurnitureNotFoundException(furnitureId);

    InterioresVariable element = getElement(elementId);
    bc.setOtherVariable(element);

    getWantedFurniture(furnitureId).bound(bc);
  }
  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;
  }
 /**
  * Returns the set of WantedFixed
  *
  * @return the collection of WantedFixed elements
  */
 public Collection<WantedFixed> getWantedFixed() {
   return fixed.getAll();
 }
 /**
  * Returns the set of WantedFurnitures
  *
  * @return the collection of WantedFurnitures
  */
 public Collection<WantedFurniture> getWantedFurniture() {
   return furniture.getAll();
 }
 public void removeUnaryConstraint(
     String elementId, Class<? extends UnaryConstraint> unaryConstraintClass) {
   furniture.get(elementId).removeUnaryConstraint(unaryConstraintClass);
 }
 public int getFixedSize() {
   return fixed.size();
 }
 public String addWantedFixed(WantedFixed wfixed) {
   return fixed.add(wfixed);
 }
 private String addWithoutChecking(String typeName) {
   return furniture.add(new WantedFurniture(typeName));
 }
 /**
  * Returns the identifiers of the WantedFixed elements
  *
  * @return the string identifying the WantedFixed
  */
 public Collection<String> getFixedNames() {
   return fixed.getElementNames();
 }
 /**
  * Returns the identifiers of the WantedFurniture
  *
  * @return the string identifying the WantedFurnitures
  */
 public Collection<String> getFurnitureNames() {
   return furniture.getElementNames();
 }
  public Collection<BinaryConstraintEnd> getBinaryConstraints(String elementId) {
    if (!furniture.containsElement(elementId))
      throw new WantedFurnitureNotFoundException(elementId);

    return furniture.get(elementId).getBinaryConstraints();
  }
 /**
  * Returns all the constraints (both unary and binary) of a given WantedFurniture.
  *
  * @param furnitureID the identifier of the WantedFurniture
  * @return the set of constraints
  */
 public Collection<UnaryConstraint> getUnaryConstraints(String elementId) {
   return furniture.get(elementId).getUnaryConstraints();
 }
 public boolean containsElement(String elementId) {
   return furniture.containsElement(elementId) || fixed.containsElement(elementId);
 }
 public WantedFurniture getWantedFurniture(String id) {
   return furniture.get(id);
 }
 public WantedFixed getWantedFixed(String id) {
   return fixed.get(id);
 }
 public void addUnaryConstraint(String elementId, UnaryConstraint unaryConstraint) {
   furniture.get(elementId).addUnaryConstraint(unaryConstraint);
 }
 /**
  * Removes the wanted element with wantedFixedId from the wishlist
  *
  * @param wantedFixedId The id of the element to be removed
  * @return A boolean representing if the operation went ok.
  * @throws MandatoryFurnitureException
  */
 public void removeWantedFixed(String wantedFixedId) {
   fixed.remove(wantedFixedId);
 }
 public int getUnfixedSize() {
   return furniture.size();
 }