Package com.tagtraum.beatunes.inspection
Class TypoInspector
- java.lang.Object
-
- com.tagtraum.beatunes.inspection.Inspector
-
- com.tagtraum.beatunes.inspection.TypoInspector
-
- All Implemented Interfaces:
DetailView
,View
,ApplicationComponent<BeaTunes>
- Direct Known Subclasses:
AlbumArtistTypoInspector
,AlbumTypoInspector
,ArtistTypoInspector
,GenreTypoInspector
public abstract class TypoInspector extends Inspector
Inspects a specific attribute of a song collection for possible typos. Typos are likely when one attribute is very similar to the same attribute of a different song.- Author:
- Hendrik Schreiber
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TypoInspector.Attribute
-
Field Summary
-
Fields inherited from class com.tagtraum.beatunes.inspection.Inspector
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description TypoInspector(BeaTunes beaTunes, String propertyName)
Sets up collator.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Issue
createIssue(List<String> similarAttributes)
Creates an issue for a possible typo.protected boolean
exclude(TypoInspector.Attribute attribute1, TypoInspector.Attribute attribute2)
Allows subclasses to specify specific excludes.protected Set<Long>
getAffectedSongIds(List<String> similarAttributes)
protected Set<AudioSong>
getAffectedSongs(List<String> similarAttributes)
String
getCategory()
Indicates the inspection's category or grouping.protected String
getMostUsedAttribute(List<String> similarAttributes)
String
getPropertyName()
Indicates which property is inspected by this inspector.void
inspect(InspectionProgressListener inspectionProgressListener)
Inspects the given songs for problems of a specific kind.-
Methods inherited from class com.tagtraum.beatunes.inspection.Inspector
addIssue, addIssues, addPropertyChangeListener, cancel, checkInterruption, clearIssues, createDisabledIcon, createIcon, getApplication, getComponent, getDescription, getFocusRoot, getIcon, getId, getInspection, getInspectionProgress, getInspectorCategory, getInspectorView, getIssueModel, getIssues, getIssues, getName, getSolution, getStatusLabel, init, isAvailable, isBeforeFirstInspection, isCancelled, isEnabled, isIndeterminateProgress, isInspecting, isPartiallyEnabled, issueCount, performInspection, performInspection, refreshLocations, removeIssue, removeIssues, removePropertyChangeListener, setApplication, setAvailable, setEnabled, setInspectionProgress, shutdown, toString
-
-
-
-
Method Detail
-
getCategory
public String getCategory()
Description copied from class:Inspector
Indicates the inspection's category or grouping. By default this returnsGENERAL
.- Overrides:
getCategory
in classInspector
- Returns:
- category, by default General
-
getPropertyName
public String getPropertyName()
Description copied from class:Inspector
Indicates which property is inspected by this inspector. This will be used when highlighting said property in views of a song that has issues.- Specified by:
getPropertyName
in classInspector
- Returns:
- property name
-
inspect
public void inspect(InspectionProgressListener inspectionProgressListener)
Description copied from class:Inspector
Inspects the given songs for problems of a specific kind. Found issues are accessible through the issues property. Implementations need to add issues usingInspector.addIssue(Issue)
. If this is a long running inspection, you might want to checkInspector.isCancelled()
every now and then and abort the inspection should the method returntrue
. Note that this method is called in a separate thread, i.e. not the event dispatch thread. You can report progress throughInspectionProgressListener.progress(Inspector, String, float)
.- Specified by:
inspect
in classInspector
- Parameters:
inspectionProgressListener
- progress listener- See Also:
Inspector.getIssues()
,Inspector.addIssue(Issue)
,Inspector.isCancelled()
-
exclude
protected boolean exclude(TypoInspector.Attribute attribute1, TypoInspector.Attribute attribute2)
Allows subclasses to specify specific excludes.- Parameters:
attribute1
- attribute 1attribute2
- attribute 2- Returns:
- true, if the attribute should be excluded as a cause for an issue. default is false
-
-