Exemplo n.º 1
0
        public void agregar(Trabajador trabajador)
        {
            bool       agregado = false;
            Trabajador temp     = head;
            Trabajador ant      = head;

            if (trabajador.SSN < head.SSN)
            {
                trabajador.Siguiente = head;
                head     = trabajador;
                agregado = true;
                length++;
            }
            else
            {
                while (temp != null)
                {
                    if (trabajador.SSN < temp.SSN)
                    {
                        trabajador.Siguiente = temp;
                        ant.Siguiente        = trabajador;
                        agregado             = true;
                        length++;
                        temp = null;
                    }
                    else
                    {
                        ant  = temp;
                        temp = temp.Siguiente;
                    }
                }
            }

            if (!agregado)
            {
                tail.Siguiente = trabajador;
                tail           = trabajador;
                length++;
            }
        }
Exemplo n.º 2
0
        public void actualizarList(AsignacionCola asignacion)
        {
            Asignacion temp  = asignacion.getHead();
            Trabajador temp1 = head;

            while (temp != null)
            {
                temp1 = head;
                while (temp1 != null)
                {
                    if (temp1.SSN == temp.getTrabajador().SSN)
                    {
                        temp1.DiasTrabajados++;
                        temp1 = temp1.Siguiente;
                    }
                    else
                    {
                        temp1 = temp1.Siguiente;
                    }
                }
                temp = temp.Siguiente;
            }
        }
Exemplo n.º 3
0
 public void setHead(Trabajador head)
 {
     this.head = head;
     this.tail = head;
     length++;
 }
Exemplo n.º 4
0
 public void setTail(Trabajador tail)
 {
     this.tail = tail;
 }