public class KeywordInfo
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<java.lang.String> |
keywords
The list of keywords relating to the concept and language
|
protected java.lang.String |
language
The language that the keywords are written in
|
protected java.lang.String |
source
The source of the keyword definitions.
|
protected java.lang.String |
topic
The topic that the keywords relate to
|
Constructor and Description |
---|
KeywordInfo()
Create a new instance of KeywordInfo with default fields: topic is
null ,
language is 'en' and source is MetaConst .META . |
KeywordInfo(java.lang.String theTopic,
java.lang.String theLanguage,
java.lang.String theSource)
Create a new instance of KeywordInfo.
|
Modifier and Type | Method and Description |
---|---|
void |
addKeyword(java.lang.String theKeyword)
Add a keyword to the list of keywords.
|
java.util.ArrayList<java.lang.String> |
getKeywords()
Get the list of keywords.
|
java.lang.String |
getLanguage()
Get the language.
|
java.lang.String |
getSource()
Get the source the keywords came from.
|
java.lang.String |
getTopic()
Get the topic.
|
boolean |
matchesWith(KeywordInfo keyInfo,
java.lang.String matchType)
Return true if the two keyword lists match on both topic and word lists.
|
protected java.lang.String topic
protected java.lang.String language
protected java.lang.String source
protected java.util.ArrayList<java.lang.String> keywords
public KeywordInfo()
null
,
language is 'en'
and source is MetaConst
.META
.public KeywordInfo(java.lang.String theTopic, java.lang.String theLanguage, java.lang.String theSource)
theTopic
- the topic the keywords relate to. This can be null if not used.theLanguage
- the language of the keywords. Can be null when it defaults
to 'en' (English).theSource
- the source of the keywords. Can be null when it defaults
to MetaConst
.META
.public boolean matchesWith(KeywordInfo keyInfo, java.lang.String matchType) throws java.lang.Exception
MetaConst
.ANYSTRUCTURE
: returns true for any match.MetaConst
.ALLPARTIAL
: the keyword must be present in both lists
but a matching position is not required. returns true if topics match and any type of
keyword list match.MetaConst
.ALLEXACT
: returns true if topics match and keyword lists
also match exactly.keyInfo
- the keyword info to match with.matchType
- the type of matching, as described. If null defaults to MetaConst
.ANYSTRUCTURE
.java.lang.Exception
- any error.public void addKeyword(java.lang.String theKeyword)
theKeyword
- the keyword to add.public java.lang.String getTopic()
public java.lang.String getLanguage()
public java.lang.String getSource()
public java.util.ArrayList<java.lang.String> getKeywords()