if语句在事务表中查找冲突

时间:2014-11-02 17:04:45

标签: java database

this is the transaction table i want to find the conflict in it.

我正在研究java项目,该项目在同一个对象中找到表事务中的冲突(如写后读)。并绘制表格的冲突图。

我试图写一个if语句给出冲突图的输出,但我不能。我发现了找到冲突动作并返回结果的语句。 有什么建议吗?

绘制冲突按钮的代码:

        int rowsNum=tTable.getRowCount();
        int columnsNum=tTable.getColumnCount();
        String[][] tableArray = new String[rowsNum][columnsNum];
        System.out.println("rows num is: " +rowsNum+" and columns num  is: "+columnsNum);
        String res=null;

        for(int cc=0;cc<columnsNum;cc++)    // this loop to read data from table and put into array.
        {
        for(int rr=0;rr<rowsNum;rr++){
        res=(String) tTable.getModel().getValueAt(rr, cc);
        tableArray[rr][cc]=res;
        }
        }
        int counter1=0;
        for (int ra=0;ra<rowsNum;ra++){   // this loop to print table width=3dd il rows
        for (int ca=0;ca<columnsNum;ca++){      

        System.out.print(" item: "+tableArray[ra][ca]);
        if(tableArray[ra][ca].equals("Write=a")){
           for (int cca=ca+1;cca<columnsNum;cca++)
           {
           for (int rra=0;rra<rowsNum;rra++)
          {
          if (tableArray[rra][cca].equals("Write=a") || tableArray[ra][ca].equals("Read=a"))
          {
          System.out.println("there is a conflict between index:"+ra+":"+ca+": and :"+rra+":"+cca );
          }
          }
           }
                          for (int cca=ca-1;cca>=0;cca++)
           {
           for (int rra=0;rra<rowsNum;rra++)
          {
          if (tableArray[rra][cca].equals("Write=a") || tableArray[ra][ca].equals("Read=a"))
          {
          System.out.println("there is a conflict between index:"+ra+":"+ca+": and :"+rra+":"+cca );
          }
          }
           }
        counter1++;
        }    
        }
        System.out.println("\n");
        }
                    System.out.println("my counter: "+counter1);

我想获取冲突位置,但if语句的输出根本不会出现。

0 个答案:

没有答案