}, {
"attribute" : "全タイプ",
"name" : "Hungry Bambi",
- "difficulty" : "MASTER+",
+ "difficulty" : "ⓁMASTER+",
"level" : 30,
"notes" : 999
}, {
"difficulty" : "MASTER+",
"level" : 28,
"notes" : 803
+ }, {
+ "attribute" : "全タイプ",
+ "name" : "星環世界",
+ "difficulty" : "DEBUT",
+ "level" : 7,
+ "notes" : 103
+ }, {
+ "attribute" : "全タイプ",
+ "name" : "星環世界",
+ "difficulty" : "REGULAR",
+ "level" : 13,
+ "notes" : 175
+ }, {
+ "attribute" : "全タイプ",
+ "name" : "星環世界",
+ "difficulty" : "PRO",
+ "level" : 17,
+ "notes" : 335
+ }, {
+ "attribute" : "全タイプ",
+ "name" : "星環世界",
+ "difficulty" : "MASTER",
+ "level" : 25,
+ "notes" : 590
+ }, {
+ "attribute" : "全タイプ",
+ "name" : "星環世界",
+ "difficulty" : "MASTER+",
+ "level" : 29,
+ "notes" : 900
+ }, {
+ "attribute" : "全タイプ",
+ "name" : "星環世界",
+ "difficulty" : "PIANO",
+ "level" : 26,
+ "notes" : 702
+ }, {
+ "attribute" : "全タイプ",
+ "name" : "星環世界",
+ "difficulty" : "FORTE",
+ "level" : 31,
+ "notes" : 1053
+ }, {
+ "attribute" : "全タイプ",
+ "name" : "イリュージョニスタ!",
+ "difficulty" : "WITCH",
+ "level" : 28,
+ "notes" : 652
+ }, {
+ "attribute" : "全タイプ",
+ "name" : "Hungry Bambi",
+ "difficulty" : "MASTER+",
+ "level" : 30,
+ "notes" : 999
+ }, {
+ "attribute" : "パッション",
+ "name" : "Shinobi 4.0 忍者のすゝめ",
+ "difficulty" : "MASTER+",
+ "level" : 29,
+ "notes" : 999
+ }, {
+ "attribute" : "パッション",
+ "name" : "にょわにょわーるど☆",
+ "difficulty" : "DEBUT",
+ "level" : 7,
+ "notes" : 101
+ }, {
+ "attribute" : "パッション",
+ "name" : "にょわにょわーるど☆",
+ "difficulty" : "REGULAR",
+ "level" : 12,
+ "notes" : 172
+ }, {
+ "attribute" : "パッション",
+ "name" : "にょわにょわーるど☆",
+ "difficulty" : "PRO",
+ "level" : 17,
+ "notes" : 340
+ }, {
+ "attribute" : "パッション",
+ "name" : "にょわにょわーるど☆",
+ "difficulty" : "MASTER",
+ "level" : 24,
+ "notes" : 541
} ]
}
\ No newline at end of file
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Random;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.function.BiConsumer;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import com.ranfa.lib.TwitterIntegration;
import com.ranfa.lib.Version;
-@Version(major = 1, minor = 0, patch = 2)
+@Version(major = 1, minor = 1, patch = 0)
public class DelesteRandomSelector extends JFrame {
private static ArrayList<Song> selectedSongsList = new ArrayList<Song>();
* Create the frame.
*/
public DelesteRandomSelector() {
+ ExecutorService es = Executors.newWorkStealingPool();
if(!Settings.fileExists() && !Settings.writeDownJSON()) {
JOptionPane.showMessageDialog(this, "Exception:NullPointerException\nCannot Keep up! Please re-download this Application!");
throw new NullPointerException("FATAL: cannot continue!");
JOptionPane.showMessageDialog(this, "Exception:NullPointerException\\nCannot Keep up! Please re-download this Application!");
throw new NullPointerException("FATAL: cannot continue!");
}
- } else if(Scraping.getFromJson().size() < Scraping.getWholeData().size()) {
- LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " + "Update detected.Initiate update process...");
- Path path = Paths.get(Scraping.getDBPath());
- try {
- Files.delete(path);
- } catch (IOException e1) {
- LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[FATAL]: " + "Exception while updating library.\n" + e1.getLocalizedMessage());
- JOptionPane.showMessageDialog(null, "データベースファイルをアップデートできませんでした。ファイルの削除権限があるかどうか確認してください。\n" + e1.getLocalizedMessage());
- }
- Scraping.writeToJson(Scraping.getWholeData());
- LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " + "Library update completed.");
}
- ExecutorService es = Executors.newWorkStealingPool();
+ CompletableFuture<ArrayList<Song>> updateFuture = CompletableFuture.supplyAsync(() -> Scraping.getWholeData(), es);
+ CompletableFuture<ArrayList<Song>> updateLocalFuture = CompletableFuture.supplyAsync(() -> Scraping.getFromJson(), es);
+ BiConsumer<ArrayList<Song>, ArrayList<Song>> updateConsumer = (list1, list2) -> {
+ if(list1.size() > list2.size()) {
+ Scraping.writeToJson(list1);
+ }
+ };
CompletableFuture<ArrayList<Song>> getFromJsonFuture = CompletableFuture.supplyAsync(() -> Scraping.getFromJson(), es);
CompletableFuture<ArrayList<Song>> getWholeDataFuture = CompletableFuture.supplyAsync(() -> Scraping.getWholeData(), es);
getWholeDataFuture.thenAcceptAsync(list -> LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: Scraping data size:" + list.size()), es);
getFromJsonFuture.thenAcceptAsync(list -> LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: Currently database size:" + list.size()), es);
+ try {
+ updateConsumer.accept(updateFuture.get(), updateLocalFuture.get());
+ } catch (InterruptedException e1) {
+ // TODO 自動生成された catch ブロック
+ e1.printStackTrace();
+ } catch (ExecutionException e1) {
+ // TODO 自動生成された catch ブロック
+ e1.printStackTrace();
+ }
LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[DEBUG]: " + "Version:" + getVersion());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 640, 360);