将数据库属性值存储到程序数组中

时间:2012-05-28 08:45:35

标签: java android sqlite

这是我的主要课程。

import java.util.logging.Logger;

public class TestD  {


    static Logger log = Logger.getLogger("graphs");


    public static GraphNode[] source = new GraphNode[5];
    public static GraphNode[] destination = new GraphNode[6];
    public static int[] distance = {};

    public static void main (String [] args){
        /*
        GraphNode A = new GraphNode("A");
        GraphNode B = new GraphNode("B");
        GraphNode C = new GraphNode("C");
        GraphNode D = new GraphNode("D");
        GraphNode E = new GraphNode("E");
        */

        for(int i =0 ; i< 5;i++)
        {
            //source[i] = 
        }

        for(int i =0 ; i< 5;i++)
        {
            //destination[i] = 
        }


        for(int i =0 ; i<= 5;i++)
        {

            source[i].AddOutgoingEdge(destination[i],  distance[i]);
        }

        /*
        A.AddOutgoingEdge(B, 5);
        A.AddOutgoingEdge(C, 20);
        B.AddOutgoingEdge(D, 1);
        C.AddOutgoingEdge(D, 3);
        C.AddOutgoingEdge(E, 1);
        D.AddOutgoingEdge(E, 100);
        */


        Graph myGraph = new Graph(source[0]);
        Dijkstra dAlg = new Dijkstra(myGraph);
        dAlg.go();
        dAlg.PrintStatusOfPriorityQ();

        p("done");
        myGraph.print();

    }

    private static void p(String s){
        System.out.println(s);
    }



}

我的数据库表架构是:

create table edges ( edgeID integer primary key autoincrement, 
        sourceNodeID integer NOT NULL ,
        destinationNodeID integer NOT NULL ,
        value1 integer NOT NULL );

我想知道如何在上面的程序中将属性值存储在相应的数组中?

我的第二个问题是如何将结果存回数据库到不同的表中?

感谢。

0 个答案:

没有答案