public String generarImagenCola()
        {
            String       dot    = "digraph g{\nrankdir=LR\nnode [shape = record, width = 0.1, height = 0.1];\n";
            String       cuerpo = "";
            NodoPilaCola aux    = inicio;

            for (int pos = 0; pos < size; pos++)
            {
                dot += "struct" + pos + " [label = \"{<f0> Suma\\n" + aux.getMatriz().getSuma() +
                       " |<f1> }\"];\n";
                if (pos == 0)
                {
                    cuerpo += "head -> struct0:f0;\n";
                }
                else
                {
                    cuerpo += "struct" + (pos - 1) + ":f1 -> struct" + pos + ":f0;\n";
                }
                aux = aux.getSiguiente();
            }
            dot += cuerpo + "struct" + (size - 1) + ":f1 -> null;\nbottom -> struct" + (size - 1) + ":f0;\n";

            dot += "label = \"Cola\"\n}";
            return(dot);
        }
예제 #2
0
        public String generarImagenPila()
        {
            String dot = "digraph g{\nrankdir=TB;\nnode [shape = record, width = 0.1, height = 0.1];\n";

            dot += "struct [label = \"{";
            NodoPilaCola aux = inicio;

            while (aux != null)
            {
                if (aux == inicio)
                {
                    dot += "<f0> Suma\\n" + aux.getMatriz().getSuma();
                }
                else
                {
                    dot += " | Suma\\n" + aux.getMatriz().getSuma();
                }
                aux = aux.getSiguiente();
            }

            dot += "}\"];\n\nlabel = \"Pila\"\n}";
            return(dot);
        }