Class Context


  • public class Context
    extends Object
    The Context class contains the context of the command line.
    • Field Detail

      • useCase

        public final UseCases useCase
        The useCase field contains the UseCase.
      • source

        public final String source
        The source field contains the source from which the data are retrieved.
      • outputArticles

        public final String outputArticles
        The output field contains the articles file name.
      • outputTerms

        public final String outputTerms
        The output field contains the terms file name.
      • query

        public final String query
        The query field contains the query to be searched.
      • countArticles

        public final int countArticles
        The countArticles field contains the number of articles to be retrieved.
      • countTerms

        public final int countTerms
        The countTerms field contains the number of terms to be extracted.
      • fromDate

        public final Date fromDate
        The fromDate field contains the date from which the articles are retrieved.
      • toDate

        public final Date toDate
        The toDate field contains the limit date to which the articles are retrieved.
      • apiKey

        public final String apiKey
        The apiKey field contains the API key.
      • lemma

        public final boolean lemma
        The lemma field contains the boolean value to decide if the terms must be lemmas or not.
    • Constructor Detail

      • Context

        public Context​(UseCases useCase,
                       String source,
                       String outputArticles,
                       String outputTerms,
                       String query,
                       int countArticles,
                       int countTerms,
                       Date fromDate,
                       Date toDate,
                       String apiKey,
                       boolean lemma)
        The Context constructor.
        Parameters:
        useCase - the useCase
        source - the source
        outputArticles - the output articles file name
        outputTerms - the output terms file name
        query - the query
        countArticles - the number of articles to be retrieved
        countTerms - the number of terms to be extracted
        fromDate - the date from which the articles are retrieved
        toDate - the limit date to which the articles are retrieved
        apiKey - the API key
        lemma - the boolean value to decide if the terms must be lemmas or not
    • Method Detail

      • fromCommandLine

        public static Context fromCommandLine​(org.apache.commons.cli.CommandLine cmd)
                                       throws org.apache.commons.cli.ParseException
        The Context factory constructor. It is used to parse the command line.
        Parameters:
        cmd - the command line
        Returns:
        the Context
        Throws:
        org.apache.commons.cli.ParseException - if the command line is not valid
      • hashCode

        public int hashCode()
        The Context hashCode method. It is used to compare two Context objects.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code