Created
July 3, 2014 14:43
-
-
Save tado/3b2dc7050938c857252a to your computer and use it in GitHub Desktop.
EneTable Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// EneTable | |
// 電力データ読み込み用クラス | |
class EneTable { | |
String date; // 日付 | |
int data[][]; // データ | |
// コンストラクタ(初期化関数) | |
// ファイルを指定して、データをパース | |
EneTable(String filename) { | |
String[] rows = loadStrings(filename); | |
String[] header = split(rows[0], ","); | |
date = header[1]; | |
data = new int[rows.length - 1][]; | |
for (int i = 1; i < rows.length - 1; i++) { | |
int[] row = int(split(rows[i], ",")); | |
data[i - 1] = (int[]) subset(row, 1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment