コード例 #1
0
        /// <summary>
        /// Genera el esquema para mostrar la informacion de la Paleta  accede a sus campos PRIVADOS.
        /// </summary>
        /// <returns></returns>
        private string Mostrar()
        {
            string        most = " Temperas Vacias. ";
            StringBuilder sb   = new StringBuilder();

            for (int i = 0; i < this.temperast.Length; i++)
            {
                most = Tempera.Mostrar(temperast[i]);
            }
            return(most);
        }
コード例 #2
0
        /// <summary>
        /// Recorre el array de temperas y retorna la posicion en la que se encuentra el parametro recibido.
        /// </summary>
        /// <param name="t1"></param>
        /// <returns></returns>
        public int obtenerIndice(Tempera t1)
        {
            int retorno = -1;

            for (int i = 0; i < this.temperast.Length; i++)
            {
                if (this.temperast[i] == t1)
                {
                    retorno = i;
                    break;
                }
            }
            return(retorno);
        }
コード例 #3
0
        public static Paleta operator +(Paleta p1, Tempera t1)
        {
            int indice = p1.obtenerIndice(t1);

            if (indice != -1)
            {
                Tempera retorno = t1 + 1;

                p1.temperast[indice] = retorno;
                return(p1);
            }
            else
            {
                p1.temperast[indice] = t1;
                return(p1);
            }
        }
コード例 #4
0
        public static Paleta operator -(Paleta p1, Tempera t1)
        {
            // Tempera retorno;
            int indice = p1.obtenerIndice(t1);

            if (indice != -1)
            {
                Tempera retorno = t1 - 1;
                p1.temperast[indice] = retorno;

                if (retorno == 0)
                {
                    p1.temperast[indice] = null;
                }
                return(p1);
            }
            return(p1);
        }
コード例 #5
0
        } // de instancia ya que no tiene la palabra static, se debe INSTANCIAR un objeto para su uso

        /// <summary>
        ///  Muestra los datos de la tempera recibida por parametro.
        /// </summary>
        /// <returns></returns>
        public static string Mostrar(Tempera t1) // De clase ya que tiene la palabra static, se accede por medio de la clase.
        {
            //  t1 = new Tempera();
            return(t1.Mostrar());
        }