解析中的联接表(Java)

解析中的联接表(Java),java,parsing,gwt,Java,Parsing,Gwt,我在记事本中有这些表,并从Java(GWT)访问记事本 我想要表格访谈中的父代码和教师姓名字段:我正确获取父代码,但问题是访谈表格中没有教师姓名,我必须从教师表格中获取教师姓名,我如何才能加入 谢谢 ##Teachers #teacherId teacherCode teacherName roomCode 56750 AC Langton, Wylie 4CJKH

我在记事本中有这些表,并从Java(GWT)访问记事本 我想要表格访谈中的父代码和教师姓名字段:我正确获取父代码,但问题是访谈表格中没有教师姓名,我必须从教师表格中获取教师姓名,我如何才能加入

谢谢

     ##Teachers
     #teacherId     teacherCode       teacherName         roomCode  
     56750              AC         Langton, Wylie          4CJKH    
     56751              AF         Nestler, Shannae        FTEJH    
     56752              AH         O'connell, Shannae      Q7STH

     ##Interviews
     #parentCode             studentKey yearLevel         teacherCode
     parentof.400052328     400052328      8                    AH              
     parentof.400052328     400052328      8                    KR      
     parentof.400052328     400052328      8                    NAt 
从上表中获取值的代码

     public ArrayList<Interviews> getParent() throws  Exception{

             ArrayList<Interviews> interviewList = new ArrayList<Interviews>();

             int interviewStartLine = 9753 ;
             int interviewEndLine =   9794 ;


                  try {
            FileInputStream fstream = new FileInputStream("c:/work/data1.txt");
            DataInputStream in = new DataInputStream(fstream);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            String strLine ="";
              int j =0;
            for(int i = 0 ; i<interviewStartLine ; i++){

                j++;
                br.readLine();
                if(j==9753){
                    for(int line = j ; line<interviewEndLine ; line++){

                        strLine = br.readLine().trim();
                        if ((strLine.length()!=0) && (strLine.charAt(0)!='#')) {
                            String[] teachers = strLine.split("\\s+");
                            System.out.println(strLine);
                            Interviews interview = new Interviews();
                            interview.setParentCode(teachers[3]);
                            interview.setTime(teachers[5]);
                            interviewList.add(interview);


                        }}}


        }
            in.close();
        } catch (Exception e) {// Catch exception if any
            System.err.println("Error: " + e.getMessage());
        }

        return interviewList;
    }

我认为正确的方法是读取文件,提取结构,然后操纵它们。例如,设计包含教师参数的教师类:

class Teacher {

    private int ID;
    private String Code;
    private String Name;

// Constructor + accessors ...

}
面试也是如此,面试是一门包含教师参考的课程

class Interview {

    private int studentKey;
    private int yearLevel;
    private Teacher teacher;

    // Constructor + accessors ...

}
class Interview {

    private int studentKey;
    private int yearLevel;
    private Teacher teacher;

    // Constructor + accessors ...

}