|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.hpi.fgis.dude.util.AbstractCleanable de.hpi.fgis.dude.algorithm.AbstractAlgorithm
public abstract class AbstractAlgorithm
AbstractAlgorithm
implements the functionality that is needed by each algorithm type.
Nested Class Summary | |
---|---|
protected static class |
AbstractAlgorithm.AlgorithmIteratorWrapper
AlgorithmIteratorWrapper is used for setting some common properties of the generated DuDeObjectPair s. |
Constructor Summary | |
---|---|
AbstractAlgorithm()
|
Method Summary | |
---|---|
void |
addDataSource(DataSource source)
Adds a DataSource to the algorithm. |
void |
addPreprocessor(DataSource source,
Preprocessor preprocessor)
Adds a Preprocessor for a specific DataSource to this algorithm. |
void |
addPreprocessor(Preprocessor preprocessor)
Adds a default Preprocessor to this algorithm. |
protected abstract void |
addSource(DataSource source)
Adds the DataSource to this instance. |
protected void |
analyzeDuDeObject(DuDeObject object)
Initiates the preprocessing for the passed DuDeObject . |
protected DuDeStorage<DuDeObject> |
createStorage(String name)
Creates the DuDeStorage instance based on the in-memory-processing flag. |
protected boolean |
dataExtracted()
Checks whether the data extraction was already done. |
protected abstract boolean |
dataSourceAttached(DataSource source)
Checks whether the passed DataSource is attached to this AbstractAlgorithm instance. |
void |
disableInMemoryProcessing()
Disables in-memory processing. |
void |
enableInMemoryProcessing()
Enables in-memory processing. |
boolean |
equals(Object obj)
|
protected void |
finishExtraction()
Sets a flag which indicates that the extraction process is finished. |
protected void |
finishPreprocessing()
Executes Preprocessor.finish() method of each added Preprocessor . |
void |
forceExtraction()
Forces a new initialization phase before returning the next Iterator . |
abstract int |
getDataSize()
Returns the overall data size after the extraction process is finished. |
int |
getDataSize(DataSource source)
Returns the data size of the passed DataSource . |
Vector<DuDeObject> |
getExtractedData()
|
int |
hashCode()
|
boolean |
inMemoryProcessingEnabled()
Checks, whether in-memory processing is enabled. |
abstract Iterator<DuDeObjectPair> |
iterator()
Starts the extraction and preprocessing phase if necessary and returns an Iterator instance for iterating over the algorithm's result. |
Methods inherited from class de.hpi.fgis.dude.util.AbstractCleanable |
---|
cleanUp, registerCleanable, registerCloseable |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.hpi.fgis.dude.algorithm.Algorithm |
---|
getMaximumPairCount, unregisterDataSources |
Methods inherited from interface de.hpi.fgis.dude.util.Cleanable |
---|
cleanUp, registerCleanable, registerCloseable |
Constructor Detail |
---|
public AbstractAlgorithm()
Method Detail |
---|
public void addPreprocessor(Preprocessor preprocessor)
Algorithm
Preprocessor
to this algorithm. This Preprocessor
processes the data of all DataSource
s.
addPreprocessor
in interface Algorithm
preprocessor
- The Preprocessor
that shall be added. Passing null
has no influence at all.public void addPreprocessor(DataSource source, Preprocessor preprocessor)
Algorithm
Preprocessor
for a specific DataSource
to this algorithm. Only data from the passed DataSource
will be
processed by this Preprocessor
. Passing null
instead of a Preprocessor
instance has no influence at all.
addPreprocessor
in interface Algorithm
source
- The corresponding DataSource
. If null
was passed instead of a DataSource
,
Algorithm.addPreprocessor(Preprocessor)
is called.preprocessor
- The Preprocessor
that shall be added.public Vector<DuDeObject> getExtractedData()
getExtractedData
in interface Algorithm
protected void analyzeDuDeObject(DuDeObject object)
DuDeObject
.
object
- The DuDeObject
that shall be preprocessed.protected void finishPreprocessing()
Preprocessor.finish()
method of each added Preprocessor
.
public void enableInMemoryProcessing()
Algorithm
enableInMemoryProcessing
in interface Algorithm
public void disableInMemoryProcessing()
Algorithm
disableInMemoryProcessing
in interface Algorithm
public boolean inMemoryProcessingEnabled()
Algorithm
inMemoryProcessingEnabled
in interface Algorithm
true
, if in-memory processing is enabled; otherwise false
.protected DuDeStorage<DuDeObject> createStorage(String name) throws IOException
DuDeStorage
instance based on the in-memory-processing flag.
name
- The name of the storage, if a FileBasedStorage
is instantiated.
DuDeStorage
instance.
IOException
- If an IO error occurred while instantiating the storage.protected void finishExtraction()
public void forceExtraction()
Iterator
. This initialization includes extraction and preprocessing.
protected boolean dataExtracted()
true
, if the data was already extracted; otherwise false
.public int getDataSize(DataSource source)
Algorithm
DataSource
.
getDataSize
in interface Algorithm
source
- The DataSource
whose size shall be returned.
DuDeObject
s of the passed DataSource
or 0
, if the data was not extracted,
yet.public abstract int getDataSize()
Algorithm
getDataSize
in interface Algorithm
DuDeObject
s or 0
, if the data was not extracted, yet.public void addDataSource(DataSource source)
Algorithm
DataSource
to the algorithm.
addDataSource
in interface Algorithm
source
- The DataSource
that shall be added.protected abstract boolean dataSourceAttached(DataSource source)
DataSource
is attached to this AbstractAlgorithm
instance.
source
- The DataSource
that shall be checked.
true
, if the passed DataSource
was added to this instance; false
otherwise or null
was passed.protected abstract void addSource(DataSource source)
DataSource
to this instance.
source
- The DataSource
that shall be added.public abstract Iterator<DuDeObjectPair> iterator()
Iterator
instance for iterating over the algorithm's result.
iterator
in interface Iterable<DuDeObjectPair>
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |