org.licas.service.model

## Class KeywordInfo

- java.lang.Object
- - org.licas.service.model.KeywordInfo

-     public class KeywordInfo
      extends java.lang.Object

  Stores information for a single set of keywords relating to a single concept.
  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    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 Summary

    Constructors
    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.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### topic

          protected java.lang.String topic

      The topic that the keywords relate to

    - #### language

          protected java.lang.String language

      The language that the keywords are written in

    - #### source

          protected java.lang.String source

      The source of the keyword definitions. Can be a URI or something else

    - #### keywords

          protected java.util.ArrayList<java.lang.String> keywords

      The list of keywords relating to the concept and language

  - ### Constructor Detail

    - #### KeywordInfo

          public KeywordInfo()

      Create a new instance of KeywordInfo with default fields: topic is `null`, language is `'en'` and source is `MetaConst`.`META`.

    - #### KeywordInfo

          public KeywordInfo(java.lang.String theTopic,
                             java.lang.String theLanguage,
                             java.lang.String theSource)

      Create a new instance of KeywordInfo.
      Parameters:
        `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`.

  - ### Method Detail

    - #### matchesWith

          public boolean matchesWith(KeywordInfo keyInfo,
                                     java.lang.String matchType)
                              throws java.lang.Exception

      Return true if the two keyword lists match on both topic and word lists.
      1. `MetaConst`.`ANYSTRUCTURE`: returns true for any match.
      2. `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.
      3. `MetaConst`.`ALLEXACT`: returns true if topics match and keyword lists also match exactly.
      Parameters:
        `keyInfo` - the keyword info to match with.
        `matchType` - the type of matching, as described. If null defaults to `MetaConst`.`ANYSTRUCTURE`.
      Returns:
        true if a match, false otherwise.
      Throws:
        `java.lang.Exception` - any error.

    - #### addKeyword

          public void addKeyword(java.lang.String theKeyword)

      Add a keyword to the list of keywords.
      Parameters:
        `theKeyword` - the keyword to add.

    - #### getTopic

          public java.lang.String getTopic()

      Get the topic.
      Returns:
        the value of topic.

    - #### getLanguage

          public java.lang.String getLanguage()

      Get the language.
      Returns:
        the value of language.

    - #### getSource

          public java.lang.String getSource()

      Get the source the keywords came from.
      Returns:
        the value of source.

    - #### getKeywords

          public java.util.ArrayList<java.lang.String> getKeywords()

      Get the list of keywords.
      Returns:
        the value of keywords.