<commit_before>package database;

import java.io.File;
import java.util.Observable;
import java.util.Observer;

import org.mapdb.DB;
import org.mapdb.DBMaker;
import org.mapdb.TxMaker;

import controller.Controller;
import settings.Settings;
import utils.ObserverMessage;

public class DatabaseSet implements Observer {

	private static final int ACTIONS_BEFORE_COMMIT = 5000;
	
	private static DatabaseSet instance;
	
	private BalanceDatabase balanceDatabase;
	private BlockDatabase blockDatabase;
	private ChildDatabase childDatabase;
	private HeightDatabase heightDatabase;
	private ReferenceDatabase referenceDatabase;
	private PeerDatabase peerDatabase;
	private TransactionDatabase transactionDatabase;
	private NameDatabase nameDatabase;
	private TransactionParentDatabase transactionParentDatabase;
	private NameExchangeDatabase nameExchangeDatabase;
	private UpdateNameDatabase updateNameDatabase;
	private CancelSellNameDatabase cancelSellNameDatabase;
	private BuyNameDatabase buyNameDatabase;
	private PollDatabase PollDatabase;
	private VoteOnPollDatabase voteOnPollDatabase;
	
	private DB database;
	//private TxMaker transactionMaker;
	private int actions;
	
	public static DatabaseSet getInstance()
	{
		if(instance == null)
		{
			//OPEN DB
			File dbFile = new File(Settings.getInstance().getDataDir(), "data.dat");
			dbFile.getParentFile().mkdirs();
			
			//DELETE TRANSACTIONS
			File transactionFile = new File(Settings.getInstance().getDataDir(), "data.dat.t");
			transactionFile.delete();	
			
			//CREATE DATABASE	
			DB database = DBMaker.newFileDB(dbFile)
					.closeOnJvmShutdown()
					.cacheLRUEnable()
					.make();
			
			TxMaker txMaker = DBMaker.newFileDB(dbFile)
					.closeOnJvmShutdown()
					.makeTxMaker();
			
			//CREATE INSTANCE
			instance = new DatabaseSet(database, txMaker);
		}
		
		return instance;
	}	
	
	public static DatabaseSet createEmptyDatabaseSet()
	{
		DB database = DBMaker.newMemoryDB()
				.make();
		<commit_msg>Updated MapDB to latest version<commit_after>package database;

import java.io.File;
import java.util.Observable;
import java.util.Observer;

import org.mapdb.DB;
import org.mapdb.DBMaker;
import org.mapdb.TxMaker;

import controller.Controller;
import settings.Settings;
import utils.ObserverMessage;

public class DatabaseSet implements Observer {

	private static final int ACTIONS_BEFORE_COMMIT = 5000;
	
	private static DatabaseSet instance;
	
	private BalanceDatabase balanceDatabase;
	private BlockDatabase blockDatabase;
	private ChildDatabase childDatabase;
	private HeightDatabase heightDatabase;
	private ReferenceDatabase referenceDatabase;
	private PeerDatabase peerDatabase;
	private TransactionDatabase transactionDatabase;
	private NameDatabase nameDatabase;
	private TransactionParentDatabase transactionParentDatabase;
	private NameExchangeDatabase nameExchangeDatabase;
	private UpdateNameDatabase updateNameDatabase;
	private CancelSellNameDatabase cancelSellNameDatabase;
	private BuyNameDatabase buyNameDatabase;
	private PollDatabase PollDatabase;
	private VoteOnPollDatabase voteOnPollDatabase;
	
	private DB database;
	//private TxMaker transactionMaker;
	private int actions;
	
	public static DatabaseSet getInstance()
	{
		if(instance == null)
		{
			//OPEN DB
			File dbFile = new File(Settings.getInstance().getDataDir(), "data.dat");
			dbFile.getParentFile().mkdirs();
			
			//DELETE TRANSACTIONS
			File transactionFile = new File(Settings.getInstance().getDataDir(), "data.dat.t");
			transactionFile.delete();	
			
			//CREATE DATABASE	
			DB database = DBMaker.newFileDB(dbFile)
					.transactionDisable()
					.closeOnJvmShutdown()
					.make();
			
			TxMaker txMaker = DBMaker.newFileDB(dbFile)
					.closeOnJvmShutdown()
					.makeTxMaker();
			
			//CREATE INSTANCE
			instance = new DatabaseSet(database, txMaker);
		}
		
		return instance;
	}	
	
	public static DatabaseSet createEmptyDatabaseSet()
	{
		DB database = DBMaker.newMemoryDB()
				.make();
		
{'fraction_non_alphanumeric': 0.07653575025176233, 'fraction_numerical': 0.002014098690835851, 'mean_word_length': 4.903417533432393, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5196514', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1094, 'n_words': 284}