/**Metodo principal para la inserción de la clave junto con su bloque de datos*/
        public bool AltaArbolBplus(CNodoEntidad e, CBloque b, long posB)
        {
            CNodo nuevo = null;
            Object clave;
            bool res = true;
            long dirClave = -1;

            clave = b.dameClavePrim();

            if (e.getApCabDatos() == -1)//Si no hay algun arbol se crea la primera pagina
            {
                nuevo = new CNodo(RAIZHOJA, GRADO);
                nuevo.setDir(getArchivo().ENDF());
                nuevo.setTipoClave(b.getTipoCA());
                getArchivo().escribeNodo(nuevo);
                e.setApCabDatos(nuevo.getDir());
                getArchivo().escribeEntidad(e, e.getDir());
            }
            else
            {
                bool bandera = false;

                res = EmpujaDato(e.getApCabDatos(), ref clave, ref dirClave, b, posB, ref nuevo, ref bandera);

                if (bandera == true)//La raiz se partido
                {
                    CNodo nuevaRaiz;
                    nuevaRaiz = new CNodo(RAIZ, GRADO);

                    nuevaRaiz.setAtClave(0, clave);
                    nuevaRaiz.setAtDirClaves(0, dirClave);
                    nuevaRaiz.setAtDirNodo(0, ent.getApCabDatos());
                    nuevaRaiz.setAtDirNodo(1, nuevo.getDir());
                    nuevaRaiz.setDir(getArchivo().ENDF());
                    nuevaRaiz.setNumElemnt(1);
                    nuevaRaiz.setTipoClave(b.getTipoCA());
                    getArchivo().escribeNodo(nuevaRaiz);
                    e.setApCabDatos(nuevaRaiz.getDir());
                    getArchivo().escribeEntidad(e, e.getDir());
                }
            }

            return (res);
        }
        private void dameBloques(ref List<CBloque> lB, CNodoEntidad nE, CBloque bS, CNodoEntidad e)
        {
            int despCE, tipoD, tamCE, tamBloq, despCB, tipoCB, tamCB;
            despCE = tipoD = tamCE = tamBloq = despCB = tipoCB = tamCB = 0;

            if (nE.getApCabDatos() != -1)
            {
                DameCE(nE, ref despCE, ref tipoD, ref tamCE, ref tamBloq, ref despCB, ref tipoCB, ref tamCB, e);
              
                creaListaBloques(nE.getApCabDatos(), ref lB, despCE, tipoD, tamCE, tamBloq, despCB, tipoCB, tamCB, bS);
            }
        }
        /**
         * Genera una lista de bloques que seran afectado al eliminar un bloque de otra 
         * entidad*/
        public void dameBloques(ref List<CBloque> lB, CNodoEntidad nE, CBloque bS, CNodoEntidad e)
        {
            CBloque aux;
            long ptrAux;
            int despCE, tipoD, tamCE, tamBloq, despCB, tipoCB, tamCB; ;
            despCE = tipoD = tamCE = tamBloq = despCB = tipoCB = tamCB = 0;

            lB = new List<CBloque>();
            ptrAux = nE.getApCabDatos();

            if (ptrAux != -1)
            {
                DameCE(nE, ref despCE, ref tipoD, ref tamCE, ref tamBloq, ref despCB, ref tipoCB, ref tamCB,e);

                while (ptrAux != -1)//Se inicializa los atributos del bloque leeido del archivo
                {
                    aux = getArchivo().leerBloque(ptrAux, tamBloq);
                    aux.setDespCE(despCE);
                    aux.setTipoCE(tipoD);
                    aux.setTamCE(tamCE);
                    aux.setDesp(despCB);
                    aux.setTamAtri(tamCB);
                    aux.setTipoCA(tipoCB);
                    aux.setTamBlo(tamBloq);

                    if (aux.CompareClaveExt(bS) == 0)//Si no es afectado se agreaga a la lista
                        lB.Add(aux);

                    ptrAux = aux.getSigBlo();
                }

            }
        }
        private void dameBloquesDatos(ref List<CBloque> lB, CNodoEntidad nE, CBloque bS, CNodoEntidad e)
        {
            CBloque aux;
            CIndice indAux;
            long ptrAux, ptrAux2;
            int despCE, tipoD, tamCE, tamBloq, despCB, tipoCB, tamCB; ;
            despCE = tipoD = tamCE = tamBloq = despCB = tipoCB = tamCB = 0;

            lB = new List<CBloque>();
            ptrAux = nE.getApCabDatos();

            if (ptrAux != -1)
            {
                DameCE(nE, ref despCE, ref tipoD, ref tamCE, ref tamBloq, ref despCB, ref tipoCB, ref tamCB, e);

                while (ptrAux != -1)
                {
                    indAux = getArchivo().LeerIndicePrimario(ptrAux);
                    ptrAux2 = indAux.getCabBloques();
                    while (ptrAux2 != -1)
                    {
                        aux = getArchivo().leerBloque(ptrAux2, tamBloq);
                        aux.setDespCE(despCE);
                        aux.setTipoCE(tipoD);
                        aux.setTamCE(tamCE);
                        aux.setDesp(despCB);
                        aux.setTamAtri(tamCB);
                        aux.setTipoCA(tipoCB);
                        aux.setTamBlo(tamBloq);
                        aux.setDir(ptrAux2);

                        if (aux.CompareClaveExt(bS) == 0)
                            lB.Add(aux); 
                        
                        ptrAux2 = aux.getSigBlo();
                    }

                    ptrAux = indAux.getSigInd();
                }
            }
        }
Beispiel #5
0
 /** Se ecribe una nueva entidad en el diccionario*/
 public void escribeEntidad(CNodoEntidad nueva, long pos)
 {
     bw.BaseStream.Seek(pos, SeekOrigin.Begin);
     bw.Write(nueva.getApSigEnt());
     bw.Write(nueva.getNombre());
     bw.Write(nueva.getApCabListAtri());
     bw.Write(nueva.getDir());
     bw.Write(nueva.getApCabDatos());
 }
        private void dameBloquesDatos(ref List<CBloque> lB, CNodoEntidad nE, CBloque bS, CNodoEntidad e)
        {
            CBloque bloqueAux;
            CTablaHashExt tH;
            List<CCubeta> listaCub;
            CCubeta cubetaAux;
            long ptrAux, ptrAux2;
            int despCE, tipoD, tamCE, tamBloq, despCB, tipoCB, tamCB; ;

            despCE = tipoD = tamCE = tamBloq = despCB = tipoCB = tamCB = 0;

            lB = new List<CBloque>();
            listaCub = new List<CCubeta>();

            ptrAux = nE.getApCabDatos();

            if (ptrAux != -1)
            {
                DameCE(nE, ref despCE, ref tipoD, ref tamCE, ref tamBloq, ref despCB, ref tipoCB, ref tamCB, e);
                tH = getArchivo().LeerTablaHashExt(ptrAux);

                foreach (CEntrada entrada in tH.getListEntradas())
                {
                    cubetaAux = entrada.getCubeta();
                    if (listaCub.Contains(cubetaAux)==false)
                    {
                        listaCub.Add(cubetaAux);

                        for (int j = 0; j < cubetaAux.getTamaño(); j++)
                            if (cubetaAux.getAtDirBloque(j) != -1)
                            {
                                bloqueAux = getArchivo().leerBloque(cubetaAux.getAtDirBloque(j), tamBloq);
                                bloqueAux.setDespCE(despCE);
                                bloqueAux.setTipoCE(tipoD);
                                bloqueAux.setTamCE(tamCE);
                                bloqueAux.setDesp(despCB);
                                bloqueAux.setTamAtri(tamCB);
                                bloqueAux.setTipoCA(tipoCB);
                                bloqueAux.setTamBlo(tamBloq);

                                if (bloqueAux.CompareClaveExt(bS) == 0)
                                    lB.Add(bloqueAux);
                            }
                    }
                }
            }
        }
        /**\brief Inserta un bloque de datos a la organización*/
        public int AltaOSI(CNodoEntidad e, CBloque nuevo, long posB)
        {
            CIndice indPri, indAux = null;
            int res;
            long ptrAux, posInd;

            
            indPri = generaIndPri(nuevo);
            getArchivo().AbrirArchivo();
            
            ptrAux = e.getApCabDatos();
            
            while (ptrAux != -1)
            {
                indPrim = getArchivo().LeerIndicePrimario(ptrAux);
                if (indPrim.comparateTo(indPri) != 0)
                    ptrAux = indPrim.getSigInd();
                else
                    break;
            }

            if (ptrAux == -1)
            {
                posInd = getArchivo().getFS().Length;
                insIndicePri(e, ref indPri,posInd);
                posB = getArchivo().getFS().Length;
                indPrim = indPri;
                res = insBloque(indPri, nuevo, posB);
            }
            else
                res = insBloque(indPrim, nuevo, posB);
           
            getArchivo().CerrarArchivo();
            return (res);
        }
        /**Método principal para la eliminación de un registro*/
        public  void EliminaHashEstatica(CNodoEntidad e, CBloque b)
        {
            CHash tablaHash;

            tablaHash = getArchivo().LeerTablaHash(e.getApCabDatos());
            EliminaBloque(tablaHash, b);

            if (tablaHash.getNumCubetas() == 0)
            {
                e.setApCabDatos(-1);
                getArchivo().escribeEntidad(e, e.getDir());
            }
        }
Beispiel #9
0
        /**Función de Mantenimiento para la Hash Estatica*/
        private void MantenimientoHashEstatica(CArchivo fileOri, CArchivo fileNew, CNodoEntidad ent, CNodoEntidad entC, int tamBloque)
        {
            CHash tablaHash, nuevaTablaHash;
            long cabTabla;

            cabTabla = ent.getApCabDatos();

            if (cabTabla != -1)
            {
                tablaHash = fileOri.LeerTablaHash(cabTabla);
                nuevaTablaHash = new CHash(fileNew.ENDF(), tablaHash.getTamaño());
                nuevaTablaHash.setNumCubetas(tablaHash.getNumCubetas());

                fileNew.EscribeTablaHash(nuevaTablaHash);

                for (int i = 0; i < tablaHash.getTamaño(); i++)
                    nuevaTablaHash.setAtDirCubeta(i, CopiarListaCubetasRec(tablaHash.getAtDirCubeta(i), fileOri, fileNew, tamBloque));

                fileNew.EscribeTablaHash(nuevaTablaHash);

                entC.setApCabDatos(nuevaTablaHash.getDir());
                fileNew.escribeEntidad(entC, entC.getDir());
            }
        }
Beispiel #10
0
        /**Función de Mantenimiento para la Hash Dinamica*/
        private void MantenimientoHashDinamica(CArchivo fileOri, CArchivo fileNew, CNodoEntidad ent, CNodoEntidad entC, int tamBloque)
        {
            CTablaHashExt tH, nuevaTH;
            List<CCubeta> listCub;
            List<int> lE;
            CCubeta nuevaCub;
            long cabDatos;

            cabDatos = ent.getApCabDatos();

            if (cabDatos != -1)
            {
                tH = fileOri.LeerTablaHashExt(cabDatos);
                nuevaTH = creaTabla(tH);

                listCub = dameCubetas(tH);
                foreach (CCubeta c in listCub)
                {
                    lE = buscaEntradas(tH, c);
                    nuevaCub = creaCubeta(c, fileNew, fileOri);

                    foreach (int i in lE)
                        nuevaTH.getAtEntrada(i).setCubeta(nuevaCub);
                }

                foreach (CEntrada e in nuevaTH.getListEntradas())
                {
                    e.setDir(fileNew.ENDF());
                    fileNew.EscribeEntrada(e);
                }

                for (int i = 0; i < nuevaTH.getListEntradas().Count - 1; i++)
                {
                    nuevaTH.getAtEntrada(i).setSigEntrada(nuevaTH.getAtEntrada(i + 1).getDir());
                    fileNew.EscribeEntrada(nuevaTH.getAtEntrada(i));
                }

                nuevaTH.setCabEntradas(nuevaTH.getAtEntrada(0).getDir());
                nuevaTH.setDir(fileNew.ENDF());
                fileNew.EscribeTablaHashExt(nuevaTH);
                entC.setApCabDatos(nuevaTH.getDir());
                fileNew.escribeEntidad(entC,entC.getDir());
            }
        }
Beispiel #11
0
 /**Función de Mantenimiento para Arboles B+*/
 public void MantenimientoArbolBplus(CArchivo fileOri, CArchivo fileNew, CNodoEntidad ent, CNodoEntidad entC, int tamBloque)
 {
     if (ent.getApCabDatos() != -1)
     {
         entC.setApCabDatos(generaArbolRec(fileOri, fileNew, tamBloque, ent.getApCabDatos()));
         fileNew.escribeEntidad(entC, entC.getDir());
     }
 }
Beispiel #12
0
        /**Función de Mantenimiento para la Organizacion Secuencial indexada*/
        public void MantenimientoSecInd(CArchivo fileOri, CArchivo fileNew, CNodoEntidad ent, CNodoEntidad entC, int tamBloque)
        {
            List<CBloque> listBloque;
            List<CIndice> listaInd;
            CIndice indPri,nuevoInd;
            long aux;
            
            listaInd = new List<CIndice>();
            
            aux = ent.getApCabDatos();
            
            while (aux != -1)
            {
                indPri = fileOri.LeerIndicePrimario(aux);
                nuevoInd = new CIndice();

                nuevoInd.setIndPrim(indPri.getIndPrim());
                nuevoInd.setTamIndPri(indPri.getTamIndPri());
                nuevoInd.setTipoInd(indPri.getTipoInd());

                listBloque = new List<CBloque>();
                
                CopiarSec(fileOri, fileNew, indPri.getCabBloques(), tamBloque, ref listBloque);
                
                nuevoInd.setDirInd(fileNew.ENDF());
                nuevoInd.setCabBloques(listBloque[0].getDir());
                fileNew.EscribeIndicePrimario(nuevoInd);
                
                listaInd.Add(nuevoInd);
                
                aux = indPri.getSigInd();
            }

            for (int i = 0; i < listaInd.Count - 1; i++)
            {
                listaInd[i].setSigInd(listaInd[i + 1].getDirInd());
                fileNew.EscribeIndicePrimario((listaInd[i]));
            }
            
            entC.setApCabDatos(listaInd[0].getDirInd());
            fileNew.escribeEntidad(entC, ent.getDir());
        }
Beispiel #13
0
        /**Funcionde Matenimiento para  la Organizacion Secuencial*/
        public void MantenimientoSec(CArchivo fileOri, CArchivo fileNew, CNodoEntidad ent, CNodoEntidad entC, int tamBloque)
        {
            List<CBloque> listBloque;

            listBloque = new List<CBloque>();
          
            CopiarSec(fileOri, fileNew, ent.getApCabDatos(), tamBloque, ref listBloque);
            
            entC.setApCabDatos(listBloque[0].getDir());
            fileNew.escribeEntidad(entC, ent.getDir());
        }
Beispiel #14
0
        /**Médoto principal para eliminar un  registro*/
        public void eliminaABplus(CNodoEntidad e, CBloque b)
        {
            long dirCabNueva = -1;

            if (eliminaClaveRec(e.getApCabDatos(), b.dameClavePrim(), ref dirCabNueva))
            {
                e.setApCabDatos(dirCabNueva);
                getArchivo().escribeEntidad(e, e.getDir());
            }
        }
        /* Inserta un indice primario en la lista de indices*/
        private void insIndicePri(CNodoEntidad e, ref CIndice nuevo, long posInd)
        {
            CIndice indAux, indAnt = null;
            long ptrAux, ptrAnt = -1;

            ptrAux = e.getApCabDatos();
            
            while (ptrAux != -1)
            {
                indAux = getArchivo().LeerIndicePrimario(ptrAux);

                if (indAux.comparateTo(nuevo) < 0)
                {
                    ptrAnt = ptrAux;
                    indAnt = indAux;
                    ptrAux = indAux.getSigInd();
                }
                else
                    break;
            }

            if (ptrAux == e.getApCabDatos())
            {
                e.setApCabDatos(posInd);
                getArchivo().escribeEntidad(e, e.getDir());
            }
            else
            {
                indAnt.setSigInd(posInd);
                getArchivo().EscribeIndicePrimario(indAnt);
            }

            nuevo.setDirInd(posInd);
            nuevo.setSigInd(ptrAux);
            getArchivo().EscribeIndicePrimario(nuevo);
        }
        /**Método principal para llevar a cabo el alta de algun bloque*/
        public int Alta_HashEstatica(CNodoEntidad e, CBloque b)
        {
            int fH, fC;
            int res;
            CHash tHash;

            fH = fC = 0;

            if (e.getApCabDatos() == -1)
            {
                tHash = new CHash(getArchivo().ENDF(), TAM_HASH);
                getArchivo().EscribeTablaHash(tHash);
                e.setApCabDatos(tHash.getDir());
                getArchivo().escribeEntidad(e, e.getDir());
            }else
                tHash = getArchivo().LeerTablaHash(e.getApCabDatos());//Se lee la tabla Hash 

            FuncionHash(b, ref fH, ref fC);
            cubetaSel = fH;
            res = InsDirBloque(tHash, fH, b, fC);

            return (res);
        }
        /**Busca si no existe un bloque en el archivo comparandolo con el nuevo*/
        public bool buscaBloqueRep(CNodoEntidad e, CBloque bO, CBloque bN)
        {
            CBloque bAux;
            CIndice indAux;
            long ptrAux, ptrAux2;
            bool band = false;
            
            getArchivo().AbrirArchivo();

            ptrAux = e.getApCabDatos();
            while (ptrAux != -1 && band != true)
            {
                indAux = getArchivo().LeerIndicePrimario(ptrAux);
                ptrAux2 = indAux.getCabBloques();
                while (ptrAux2 != -1)
                {
                    bAux = getArchivo().leerBloque(ptrAux2, tamBloque);

                    if (indPrim.comparateTo(indAux) == 0)
                    {
                        if (bO.ComparateTo(bAux) != 0 && bN.ComparateTo(bAux) == 0)
                        {
                            band = true;
                            break;
                        }
                    }else
                        if (bN.ComparateTo(bAux) == 0)
                        {
                            band = true;
                            break;
                        }


                    ptrAux2 = bAux.getSigBlo();
                }

                ptrAux = indAux.getSigInd();
           }

            getArchivo().CerrarArchivo();

            return (band);
        }
        private void dameBloquesDatos(ref List<CBloque> lB, CNodoEntidad nE, CBloque bS, CNodoEntidad e)
        {
            CBloque bloqueAux;
            CHash tablaAux;
            Cubeta cubetaAux;
            long ptrAux, ptrAux2;
            int despCE, tipoD, tamCE, tamBloq, despCB, tipoCB, tamCB; ;
            
            despCE = tipoD = tamCE = tamBloq = despCB = tipoCB = tamCB = 0;

            lB = new List<CBloque>();
            ptrAux = nE.getApCabDatos();

            if (ptrAux != -1)
            {
                DameCE(nE, ref despCE, ref tipoD, ref tamCE, ref tamBloq, ref despCB, ref tipoCB, ref tamCB, e);
                tablaAux = getArchivo().LeerTablaHash(ptrAux);

                for(int i = 0; i < tablaAux.getTamaño(); i++)
                    if( (ptrAux2 = tablaAux.getAtDirCubeta(i)) != -1)
                        while(ptrAux2 != -1 )
                        {
                            cubetaAux = getArchivo().LeerCubetaHashEstatica(ptrAux2);
                            for(int j = 0; j < cubetaAux.getTamaño(); j++)
                                   if(cubetaAux.getAtDirBloque(j) != -1 )
                                   {
                                       bloqueAux = getArchivo().leerBloque(cubetaAux.getAtDirBloque(j),tamBloq);
                                       bloqueAux.setDespCE(despCE);
                                       bloqueAux.setTipoCE(tipoD);
                                       bloqueAux.setTamCE(tamCE);
                                       bloqueAux.setDesp(despCB);
                                       bloqueAux.setTamAtri(tamCB);
                                       bloqueAux.setTipoCA(tipoCB);
                                       bloqueAux.setTamBlo(tamBloq);
                                      
                                       if (bloqueAux.CompareClaveExt(bS) == 0)
                                           lB.Add(bloqueAux);
                                   }
                                
                             ptrAux2 = cubetaAux.getSigCubeta();
                        }
            }
        }
        /** Se elimina un indice primiraio*/
        public void eliminaIndicePrimario(CNodoEntidad e, CIndice ind)
        {
            CIndice bloAux, bloAnt;
            long ptrAux, ptrAnt;

            bloAux = bloAnt = null;
            ptrAux = ptrAnt = -1;

            ptrAux = e.getApCabDatos();

            while (ptrAux != -1)
            {
                bloAux = getArchivo().LeerIndicePrimario(ptrAux);

                if (ind.comparateTo(bloAux) != 0 )
                {
                    ptrAnt = ptrAux;
                    bloAnt = bloAux;
                    ptrAux = bloAux.getSigInd();
                }
                else
                    break;
            }

            if (ptrAux == e.getApCabDatos())
            {
                e.setApCabDatos(bloAux.getSigInd());
                getArchivo().escribeEntidad(e, e.getDir());
            }
            else
            {
                bloAnt.setSigInd(bloAux.getSigInd());
                getArchivo().EscribeIndicePrimario(bloAnt);
            }
        }
        /**´Méetodo principal para llevar a cabo la inserción de algun bloque*/
        public bool Alta_HashDinamica(CNodoEntidad e, CBloque b)
        {
            /**
             * \param e Entidad a la que pertrnece el bloque
             * \param b Bloque Nuevo bloque a insertar
             * \return Retorna Falso(Si tuvo exito), True(Si ya existe el bloque alguna cubeta)
             * */
            CCubeta cubetaAux;
            CEntrada entradaAux;
            bool res = false;

            if (e.getApCabDatos() == -1)
            {
                tHashExt = new CTablaHashExt(); 
                cubetaAux = new CCubeta(-1, TAM_CUBETA); 
                entradaAux = new CEntrada(cubetaAux, -1);
                
                tHashExt.insEntrada(entradaAux);

                cubetaAux.setDir(getArchivo().ENDF());
                getArchivo().EscribeCubeta(cubetaAux);

                entradaAux.setDirCubeta(cubetaAux.getDir());
                entradaAux.setDir(getArchivo().ENDF());
                getArchivo().EscribeEntrada(entradaAux);

                tHashExt.setCabEntradas(entradaAux.getDir());
                tHashExt.setDir(getArchivo().ENDF());
                getArchivo().EscribeTablaHashExt(tHashExt);

                e.setApCabDatos(tHashExt.getDir());
                getArchivo().escribeEntidad(e, e.getDir());
            }
            else
                tHashExt = getArchivo().LeerTablaHashExt(e.getApCabDatos());

            b.setDir(getArchivo().ENDF());
         
            if ((res = InsBloque(b)) == false)
            {
                tHashExt.incNumReg();
                getArchivo().EscribeTablaHashExt(tHashExt);
            }

            return (res);
        }
        /**Método principal para llevar a cabo la elimianción de un registro*/
        public void eliminaOSI(CNodoEntidad e, CBloque b)
        {
            CIndice index, index2 = null;
            long ptrAux;

            index = generaIndPri(b);
            ptrAux = e.getApCabDatos();

            while (ptrAux != -1)
            {
                index2 = getArchivo().LeerIndicePrimario(ptrAux);

                if (index2.comparateTo(index) < 0)
                    ptrAux = index2.getSigInd();
                else
                    break;
            }

            eliminaBloque(ref index2, b);

            if (index2.getCabBloques() == -1)
                eliminaIndicePrimario(e, index2);
        }
        /**Método principal para llevar a cabo la eliminación de algun bloque*/
        public void Elimina_BloqueHashDinamica(CNodoEntidad e, CBloque b)
        {
            CTablaHashExt tH;
            /**
             * \param e Entidad a la que pertenece el nuevo bloque
             * \param b Objeto del nuevo bloque
             * */

            tH = getArchivo().LeerTablaHashExt(e.getApCabDatos());
            if (EliminaBloque(b, tH))
            {
                e.setApCabDatos(-1);
                getArchivo().escribeEntidad(e, e.getDir());
            }
        }
        /**\brief Baja de un registro*/
        public void BajaOS(CBloque blo, CNodoEntidad e, int tamB)
        {
            /**
             * \details
             * Elimina una registro del archivo secuencial. Para ello accede al primer registro
             * y busca el bloque a eliminar.
             * \param blo Bloque que sera eliminado.
             * \param e Entidad donde se ecuentra este bloque
             * \param tamB Tamaño del bloque
             * */

            CBloque bloAux, bloAnt;
            long ptrAux, ptrAnt;

            bloAux = bloAnt = null;
            ptrAux = ptrAnt = -1;
           
            ptrAux = e.getApCabDatos();

            while (ptrAux != -1)//Se busca la dirección del bloque
            {
                bloAux = getArchivo().leerBloque(ptrAux, tamB);

                if (blo.ComparateTo(bloAux) != 0)
                {
                    ptrAnt = ptrAux;
                    bloAnt = bloAux;
                    bloAnt.setTamBlo(tamB);
                    ptrAux = bloAux.getSigBlo();
                }
                else
                    break;
                
            }

            if (ptrAux == e.getApCabDatos())//Si es el primer bloque, se actualiza la cabecera de la entidad
            {
                e.setApCabDatos(bloAux.getSigBlo());
                getArchivo().escribeEntidad(e, e.getDir());
            }
            else
            {
                bloAnt.setSigBlo(bloAux.getSigBlo());
                bloAnt.setTamBlo(tamB);
                getArchivo().EscribeBloque(bloAnt, ptrAnt);
            }
        }