AKAI TSUKI

System development or Technical something

日付memo

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TimeAnalyLogic
{
    // 形式を以下の通りとする。
    // 日付,時間,key,ID

    /** date index number */
    private static final int DATE_IDX = 0;

    /** time index number */
    private static final int TIME_IDX = 1;

    /** key index number */
    private static final int KEY_IDX  = 2;

    /** id index number */
    private static final int ID_IDX   = 3;

    public void execute() throws IOException
    {
        String startFilePath = "data/start.txt";
        String endFilePath = "data/end.txt";

        String startKey = "aaa";
        String endKey = "bbb";

        //ファイル読み込み
        File startFile = new File(startFilePath);
        BufferedReader br = new BufferedReader(new FileReader(startFile));

        Map<String, List<Date>> startTimeMap = new HashMap<String, List<Date>>();

        String str = br.readLine();
        while (str != null)
        {
            String[] data = str.split(",");
            if (startKey.equals(data[KEY_IDX]))
            {
                List<Date> tmp = startTimeMap.get(data[ID_IDX]);

                if (tmp != null)
                {
                    tmp = new ArrayList<Date>();
                    Date tmpDate = new Date()

                }
            }

            startTimeMap.str = br.readLine();
        }

        File endFile = new File(endFilePath);

        // 1.

    }
}


とりあえず、SimpleDateFormatを使えば日付の扱いはうまくできたわ。