public class Base extends java.lang.Object implements PrettyPrint
All the data is binded once, note that adding or rebinding data in here is expensive. Use ClusterMatrix
for a dynamic
database.
ClusterMatrix
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<java.lang.Integer,Cluster> |
clusters
Hosts all the Clusters :
HashMap<clusterId,Cluster> |
protected java.util.HashMap<java.lang.Integer,Time> |
times
Hosts all the Times :
HashMap<timeId,Time>
|
protected java.util.HashMap<java.lang.Integer,Transaction> |
transactions
Hosts all the Transactions :
HashMap<transactionId,Transaction>
|
Constructor and Description |
---|
Base()
Initializes an empty Base
|
Base(java.util.HashMap<java.lang.Integer,java.util.Set<java.lang.Integer>> clustersTransactions,
java.util.HashMap<java.lang.Integer,java.lang.Integer> clustersTime)
Fills and binds the Base using the parameters
|
Modifier and Type | Method and Description |
---|---|
void |
add(Cluster cluster)
Adds the cluster to the base
|
void |
add(Time time)
Adds the time to the base
|
void |
add(Transaction transaction)
Adds the transaction to the base
|
boolean |
areTransactionsInCluster(java.util.Set<java.lang.Integer> transactionIds,
int clusterId)
Checks whether all the transactions are contained in the
cluster.
|
Cluster |
getCluster(int clusterId)
Returns the
Cluster
having this id, null otherwise
|
java.util.TreeSet<java.lang.Integer> |
getClusterIds()
|
java.util.HashMap<java.lang.Integer,Cluster> |
getClusters()
|
int |
getClusterTimeId(int clusterId)
Returns the timeId of the cluster
Shortcut for
getCluster(clusterId) .
|
java.util.HashMap<java.lang.Integer,Transaction> |
getClusterTransactions(int clusterId)
Retrieves all the transactions of a specific cluster.
|
java.util.Set<java.lang.Integer> |
getFilteredTransactionIdsIfHaveCluster(java.util.Set<java.lang.Integer> transactionIds,
int clusterId)
Checks and returns a list of transactions from
transactionIds which are contained in the cluster (clusterId)
|
Cluster |
getOrCreateCluster(int clusterId)
Checks whether the clusterId is present, if not creates one.
|
Time
|
getOrCreateTime(int timeId)
Check whether the timeId is present, if not creates one.
|
Transaction |
getOrCreateTransaction(int transactionId)
Check whether the transactionId is present, if not creates one.
|
Time
|
getTime(int timeId)
Returns the
Time having
this id, null otherwise
|
java.util.TreeSet<java.lang.Integer> |
getTimeIds()
|
java.util.HashMap<java.lang.Integer,Time> |
getTimes()
|
Transaction |
getTransaction(int transactionId)
Returns the
Transaction
having this id, null otherwise
|
java.util.HashMap<java.lang.Integer,Cluster> |
getTransactionClusters(int transactionId)
Retrieves all the clusters of a specific transaction.
|
java.util.TreeSet<java.lang.Integer> |
getTransactionIds()
|
java.util.HashMap<java.lang.Integer,Transaction> |
getTransactions()
|
java.lang.String |
toPrettyString()
Displays a prettified version of
Object.toString()
It's used as display by Debug if
it's implemented.
|
java.lang.String |
toString()
|
protected java.util.HashMap<java.lang.Integer,Time> times
HashMap<timeId,Time>
protected java.util.HashMap<java.lang.Integer,Cluster> clusters
HashMap<clusterId,Cluster>
protected java.util.HashMap<java.lang.Integer,Transaction> transactions
HashMap<transactionId,Transaction>
public Base()
public Base(java.util.HashMap<java.lang.Integer,java.util.Set<java.lang.Integer>> clustersTransactions, java.util.HashMap<java.lang.Integer,java.lang.Integer> clustersTime)
clustersTransactions
- link between clusters and transactions 1:x
relation
clustersTime
- link between clusters and its time 1:1 relationpublic void add(Cluster cluster)
cluster
- cluster to addpublic void add(Transaction transaction)
transaction
- transaction to addpublic void add(Time time)
time
- time to addpublic Cluster getOrCreateCluster(int clusterId)
clusterId
- id to checkpublic Time getOrCreateTime(int timeId)
timeId
- id to checkpublic Transaction getOrCreateTransaction(int transactionId)
transactionId
- id to checkpublic Cluster getCluster(int clusterId)
Cluster
having
this id, null
otherwise
clusterId
- id of the clusterCluster
or
null
HashMap.get(Object)
public Time getTime(int timeId)
Time
having this
id, null
otherwise
timeId
- id of the timeTime
or null
HashMap.get(Object)
public Transaction getTransaction(int transactionId)
Transaction
having this id, null
otherwise
transactionId
- id of the transactionTransaction
or null
HashMap.get(Object)
public java.util.HashMap<java.lang.Integer,Cluster> getClusters()
HashMap
public java.util.HashMap<java.lang.Integer,Time> getTimes()
HashMap
public java.util.HashMap<java.lang.Integer,Transaction> getTransactions()
HashMap
public java.util.TreeSet<java.lang.Integer> getClusterIds()
TreeSet
public java.util.TreeSet<java.lang.Integer> getTimeIds()
TreeSet
public java.util.TreeSet<java.lang.Integer> getTransactionIds()
TreeSet
public java.util.HashMap<java.lang.Integer,Transaction> getClusterTransactions(int clusterId)
Shortcut for getCluster(clusterId).getTransactions()
clusterId
- id of the Cluster
HashMap
public java.util.HashMap<java.lang.Integer,Cluster> getTransactionClusters(int transactionId)
Shortcut for getTransaction(transactionId).getClusters()
transactionId
- id of the Transaction
HashMap
public java.util.Set<java.lang.Integer> getFilteredTransactionIdsIfHaveCluster(java.util.Set<java.lang.Integer> transactionIds, int clusterId)
transactionIds
- list of transactions to check fromclusterId
- the cluster to filter thempublic boolean areTransactionsInCluster(java.util.Set<java.lang.Integer> transactionIds, int clusterId)
Shortcut for getClusterTransactions(clusterId)
.keySet()
.containsAll(transactionIds)
Dans GetMove :
Lcm::CheckItemInclusion(DataBase,transactionList,item)
transactionIds
- (transactionList) set of transactionIdsclusterId
- (item) the concerned clustertrue
of the set is contained in the clusterpublic int getClusterTimeId(int clusterId)
Shortcut for getCluster(clusterId)
.getTimeId()
clusterId
- id of the clusterpublic java.lang.String toPrettyString()
PrettyPrint
Object.toString()
It's used as display by Debug
if it's
implemented.
toPrettyString
in
interface PrettyPrint
Object.toString()
public java.lang.String toString()
toString
in class java.lang.Object