package model;


/**
 * Created by ano on 2016. 5. 13..
 */
public class FileManager {

    private static FileManager instance;
    private FileModel FileModelL = new FileModel();
    private FileModel FileModelR = new FileModel();
    private FileManager(){}

    /**
     * FileManager 객체를 반환합니다.
     * @return FileManager 양 쪽 Editor에 할당된 파일들을 관리하는 매니저
     */
    public static FileManager getFileManager() { // 1개의 객체를 유지하기 위한 싱글톤
        if(instance == null)
            instance = new FileManager();
        return instance;
    }

    /**
     * Left Editor에 할당된 File Model을 반환합니다.
     * @return FileModel 왼쪽 Editor에 할당된 FileModel
     */
    public FileModel getFileModelL()
    {
        return FileModelL;
    }

    /**
     * Right Editor에 할당된 File Model을 반환합니다.
     * @return FileModel 오른쪽 Editor에 할당된 FileModel
     */
    public FileModel getFileModelR()
    {
        return FileModelR;
    }
    private int[][] arrayLCS;
    public void runLCS()
    {
        arrayLCS = new int[FileModelL.getlLneArrayList().size()][FileModelR.getlLneArrayList().size()];//초기화


    }
    private void buildArrayLCS(int[][] arr)
    {

    }

}

@@ -9,16 +9,44 @@
 model;%0A%0A
+import java.util.ArrayList;%0A
 %0A/**%0A * 
@@ -1058,16 +1058,20 @@
 ).size()
+ + 1
 %5D%5BFileMo
@@ -1104,16 +1104,20 @@
 ze()
+ + 1
 %5D;//%EC%B4%88%EA%B8%B0%ED%99%94%0A
 %0A%0A  
@@ -1112,24 +1112,153 @@
 %5D;//%EC%B4%88%EA%B8%B0%ED%99%94%0A
-%0A
+        buildArrayLCS(arrayLCS);%0A    %7D%0A    private int max(int a, int b)%0A    %7B%0A        if(a %3E b) return a;%0A        else return b;
 %0A    %7D%0A
+%0A
     priv
@@ -1299,16 +1299,775 @@
 )%0A    %7B%0A
+        ArrayList%3CLine%3E leftArr = FileModelL.getlLneArrayList(); // width%0A        ArrayList%3CLine%3E rightArr = FileModelR.getlLneArrayList(); // height%0A        int width = arr.length;%0A        int height = arr%5B0%5D.length;%0A        for(int i = 0; i %3C= width; i++)%0A        %7B%0A            for(int j = 0; j %3C= height ; j++)%0A            %7B%0A                if(i == 0 %7C%7C j == 0) arr%5Bi%5D%5Bj%5D = 0;%0A                else%0A                %7B%0A                    if(leftArr.get(i-1) == rightArr.get(j-1))%0A                    %7B%0A                        arr%5Bi%5D%5Bj%5D = arr%5Bi-1%5D%5Bj-1%5D + 1;%0A                    %7D%0A                    else%0A                    %7B%0A                        arr%5Bi%5D%5Bj%5D = max(arr%5Bi-1%5D%5Bj%5D,arr%5Bi%5D%5Bj-1%5D);%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A%0A%0A
 %0A    %7D%0A%0A

add buildLCS method to FileManager