Package englishlanguage
Class Article
- java.lang.Object
-
- englishlanguage.Article
-
- All Implemented Interfaces:
Word<java.lang.String>
public class Article extends java.lang.Object implements Word<java.lang.String>
The main feature of this class is to store internally (as a String) an english article. The idea of this class is to provide a short and easy way to classify a word in respect to english language. This could be used with the Markov Chains to create clearer random sentences and provide a good way to classify words.- Since:
- 1.0 SNAPSHOT
- Author:
- Arthur Brenno
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static @NotNull Article
createArticle(java.lang.String article)
Factory.static @NotNull Article
createOrRandom(java.lang.String article)
Factory.static @NotNull Article
createRandom()
Factory.java.lang.String
getContent()
Getter.
-
-
-
Method Detail
-
createRandom
@Contract(" -> new") @NotNull public static @NotNull Article createRandom()
Factory. Creates a random Article object. This object will contain, as its only instance variable, a random english article.- Returns:
- An Article object. This object contains a random article as "article" instance variable
-
createArticle
@Contract("_ -> new") @NotNull public static @NotNull Article createArticle(java.lang.String article)
Factory. Creates an Article if the input is valid.- Parameters:
article
- to be verified.- Returns:
- An Article object. This object will contain an article if the article provided is really an article.
- Throws:
java.lang.RuntimeException
- the argument is not an article.
-
createOrRandom
@Contract("_ -> new") @NotNull public static @NotNull Article createOrRandom(java.lang.String article)
Factory. Creates an article by the input or a random article.- Parameters:
article
- to be verified.- Returns:
- Article instance.
-
getContent
public java.lang.String getContent()
Getter.- Specified by:
getContent
in interfaceWord<java.lang.String>
- Returns:
- the article that the object represents.
-
-