Skip to content

Commit

Permalink
feat(qmp): user's wardrobe
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasanchez committed May 27, 2021
1 parent 8ba9bd7 commit 122db8b
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package quemepongo.model.usuario.guardarropa;

import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import quemepongo.model.prenda.Categoria;
import quemepongo.model.prenda.Prenda;

/**
* Guardarropa, repositorio de Prendas.
*
* @since 05.27.2021
* @version 1.0
*/
public class Guardarropa {

/**
* Prendas categorizadas.
*
* @since Iteración V
*/
Map<Categoria, Set<Prenda>> prendas = new HashMap<Categoria, Set<Prenda>>();

public Guardarropa() {

Categoria[] categorias = Categoria.values();

for (Categoria categoria : categorias) {
prendas.put(categoria, new LinkedHashSet<Prenda>());
}
}

/**
* Agrega una prenda al guardarropas.
*
* @param prenda la prenda a añadir
* @return el guardarropa
* @since Iteración V
*/
public Guardarropa agregarPrenda(Prenda prenda) {

Set<Prenda> prendasDeCategoria = prendas.get(prenda.categoria());
prendasDeCategoria.add(prenda);

return this;
}
}

0 comments on commit 122db8b

Please sign in to comment.