ca.pfv.spmf.algorithms.associationrules.TopKRules_and_TNR
Class Database
- java.lang.Object
-
- ca.pfv.spmf.algorithms.associationrules.TopKRules_and_TNR.Database
-
public class Database extends java.lang.ObjectThis class represents a transaction database optimized for the TNR and TopKRules algorithms for top-k association rule mining.
It contains a list of transaction implemented as linked-lists and keep track of the largest item ids and the total number of transactions in the database.
The main method is loadFile() for reading a file. But transactions can also be added manually by calling the method addTransaction.- See Also:
AlgoTNR,AlgoTopKRules,Transaction
-
-
Field Summary
Fields Modifier and Type Field and Description intmaxItemthe largest item in the databaseinttidsCountthe number of transactions in the database
-
Constructor Summary
Constructors Constructor and Description Database()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddTransaction(java.lang.String[] itemsString)Read a transaction from the file and store it into memoryjava.util.List<Transaction>getTransactions()Get the list of transactions in this database.voidloadFile(java.lang.String path)Load a file from a file path.intsize()Get the number of transactions.
-
-
-
Field Detail
-
maxItem
public int maxItem
the largest item in the database
-
tidsCount
public int tidsCount
the number of transactions in the database
-
-
Method Detail
-
loadFile
public void loadFile(java.lang.String path) throws java.io.IOExceptionLoad a file from a file path.- Parameters:
path- the input file path- Throws:
java.io.IOException- exception if an error while writing the file
-
addTransaction
public void addTransaction(java.lang.String[] itemsString)
Read a transaction from the file and store it into memory- Parameters:
itemsString- an array of items, where an item is an integer represented as a String.
-
size
public int size()
Get the number of transactions.- Returns:
- the number of transactions
-
getTransactions
public java.util.List<Transaction> getTransactions()
Get the list of transactions in this database.- Returns:
- a List of Transactions
-
-
DMelt 3.0 © DataMelt by jWork.ORG