예제 #1
0
        public static string MostrarEstante(Estante e)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("Estante {0}", e.ubicacionEstante);
            for (int i = 0; i < e.productos.Length; i++)
            {
                if (!(Object.ReferenceEquals(e.productos[i], null)))
                {
                    builder.AppendLine(Producto.mostrarProducto(e.productos[i]));
                }
            }
            return(builder.ToString());
        }
예제 #2
0
        /*private int estantesOcupados(Estante e)
         * {
         *
         *  for(int i = 0; i < e.productos.Length; i++){
         *      if(Object.ReferenceEquals(productos[i], null){
         *          return i;
         *          break;
         *      }
         *  }
         * }*/

        public static Estante operator -(Estante e, Producto p)
        {
            Estante retorno = null;

            Producto[] productos = e.GetProductos();
            if (e == p)
            {
                for (int i = 0; i < productos.Length; i++)
                {
                    if (productos[i] == p)
                    {
                        productos[i] = null;
                    }
                }
            }
            return(retorno);
        }