public class Solver extends java.lang.Object implements PrettyPrint
It's used to call ItemsetsFinder
to detect all the itemsets per block
It's used to call BlockMerger
to merge them in a single array of itemsets used for detecting different patterns with their
given detectors.
Constructor and Description |
---|
Solver(ItemsetsFinder itemsetsFinder,
BlockMerger blockMerger,
java.util.Set<SingleDetector> singleDetectors,
java.util.Set<MultiDetector> multiDetectors,
Config config)
Prepares the solver with all the elements used to detect
patterns.
|
Modifier and Type | Method and Description |
---|---|
void |
add(MultiDetector multiDetector)
MultiDetector.detect(DataBase,
Collection) is called for all Itemsets.
|
void |
add(SingleDetector singleDetector)
SingleDetector.detect(DataBase,
Itemset) is called foreach itemset.
|
java.util.HashMap<Detector,java.util.ArrayList<Pattern>>
|
detectPatterns(DataBase dataBase,
java.util.ArrayList<Itemset> itemsets)
Call BlockMerger and launches the pattern detection system
|
java.util.ArrayList<java.util.ArrayList<Itemset>> |
findItemsets(DataBase dataBase)
Finds all the itemsets in the database.
|
java.util.ArrayList<Itemset> |
mergeBlocks(java.util.ArrayList<java.util.ArrayList<Itemset>> results)
Here we will be merging itemsets with each others across blocks
so the basic principle is that we will be invoking itemsetsFinder on a different
level.
|
void |
remove(MultiDetector multiDetector)
|
void |
remove(SingleDetector singleDetector)
|
javax.json.JsonArrayBuilder |
toJson(java.util.HashMap<Detector,java.util.ArrayList<Pattern>> detectors)
|
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()
|
public Solver(ItemsetsFinder itemsetsFinder, BlockMerger blockMerger, java.util.Set<SingleDetector> singleDetectors, java.util.Set<MultiDetector> multiDetectors, Config config)
itemsetsFinder
- DI, has for function to find all the itemsets of
the database
blockMerger
- DI, has for funtion to merge all the blocks created
by the itemsetsFinder
singleDetectors
- DI, initializes all the singleDetectors to use
multiDetectors
- DI, initializes all the multiDetectors to useconfig
- configurationpublic java.util.ArrayList<java.util.ArrayList<Itemset>> findItemsets(DataBase dataBase)
Breaks the task by blocks (a given time interval Config.blockSize
) and returns an array of blocks containing their respective itemsets.
If the Config.blockSize
is 0, then a single block is returned, containing all the itemset of the
database.
dataBase
- databasepublic java.util.HashMap<Detector,java.util.ArrayList<Pattern>> detectPatterns(DataBase dataBase, java.util.ArrayList<Itemset> itemsets)
dataBase
- databaseitemsets
- itemsets to detect pattern frompublic java.util.ArrayList<Itemset> mergeBlocks(java.util.ArrayList<java.util.ArrayList<Itemset>> results)
results
- array of blocks and their itemsetspublic void add(SingleDetector singleDetector)
SingleDetector.detect(DataBase,
Itemset)
is called foreach itemset.
singleDetector
- adds this detector to the list of detectors to
detect
public void add(MultiDetector multiDetector)
MultiDetector.detect(DataBase,
Collection)
is called for all Itemsets.
multiDetector
- adds this detector to the list of detectors to
detect
public void remove(SingleDetector singleDetector)
singleDetector
- removes this detector from the list of detectors
to detect
public void remove(MultiDetector multiDetector)
multiDetector
- removes this detector from the list of detectors to
detect
public javax.json.JsonArrayBuilder toJson(java.util.HashMap<Detector,java.util.ArrayList<Pattern>> detectors)
public 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