|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.musicontroller.core.LinkableAbs
org.musicontroller.core.Keyword
public class Keyword
A Keyword is a namable property of a Song. Keywords are hierarchical objects. Their ordering is lexicographical after their name. The keyword names are case insensitive.
Field Summary | |
---|---|
static int |
_maxSimilarity
|
static int |
_maxSimilarityPower
|
Constructor Summary | |
---|---|
Keyword()
|
Method Summary | |
---|---|
boolean |
addChild(Keyword keyword)
Adds a Keyword as a Child of this Keyword. |
static int |
calculateSimilarity(boolean commonAncestorFound,
int generalisations,
int specialisations)
calculate the similarity score based on the number of generalisations needed to get from one keyword to another. |
int |
compareTo(Keyword other)
|
static Keyword |
construct(java.lang.String name)
Factory method constructs a keyword with the given name and a null parent. |
static Keyword |
construct(java.lang.String name,
Keyword parent)
Factory method constructs a keyword with the given name and parent. |
static java.util.Set<Keyword> |
constructHierarchy(java.util.Collection<Keyword> keywords)
Constructs a Set of Keywords which are all topmost Keywords in the hierarchical Keyword-ordering. |
boolean |
equals(java.lang.Object obj)
Define Keyword business equality. |
int |
getChildCount()
Returns the amount of children (including grandchildren, etc) of this parent. |
java.util.Set<Keyword> |
getChildren()
The (non-persistent) Children of this Keyword. |
Keyword |
getParent()
|
java.lang.String |
getType()
|
int |
hashCode()
|
boolean |
isChildOf(Keyword other)
Determines if this keyword is a child of another keyword. |
void |
setParent(Keyword parent)
|
int |
similarityScore(Keyword keyword,
java.lang.StringBuilder sbout)
Calculates similarity between keywords. |
java.lang.String |
toString()
A short human readable representation of the keyword. |
Methods inherited from class org.musicontroller.core.LinkableAbs |
---|
getChanged, getId, getInserted, getName, normalizeName, setChanged, setId, setInserted, setName |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int _maxSimilarityPower
public static final int _maxSimilarity
Constructor Detail |
---|
public Keyword()
Method Detail |
---|
public static Keyword construct(java.lang.String name)
name
-
public static Keyword construct(java.lang.String name, Keyword parent)
name
-
public Keyword getParent()
public void setParent(Keyword parent) throws KeywordCycleException
KeywordCycleException
public boolean isChildOf(Keyword other)
other
- The other keyword.
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int similarityScore(Keyword keyword, java.lang.StringBuilder sbout)
keyword
- The Keyword to compare this one to. This may not be NULL (will throw NullPointerException).
public static int calculateSimilarity(boolean commonAncestorFound, int generalisations, int specialisations)
commonAncestorFound
- True if the compared keyword have a shared ancestor.generalisations
- The number of generalisations.specialisations
- The number of specialisations.
public java.lang.String getType()
getType
in interface Linkable
public java.util.Set<Keyword> getChildren()
public boolean addChild(Keyword keyword)
keyword
- The (non-null) Child.
public static java.util.Set<Keyword> constructHierarchy(java.util.Collection<Keyword> keywords)
keywords
- All Keywords.
public int getChildCount()
public int compareTo(Keyword other)
compareTo
in interface java.lang.Comparable<Keyword>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |