51 lines
1.5 KiB
Java
51 lines
1.5 KiB
Java
import lab5lib.Fetcher;
|
|
|
|
public class Main {
|
|
public static void main(String[] args) {
|
|
boolean demoContent;
|
|
|
|
demoContent = parseArgs(args);
|
|
String inputString = getInput(demoContent);
|
|
System.out.println(inputString);
|
|
|
|
Text text = new Text(inputString);
|
|
text.cleanFirstSentence();
|
|
|
|
System.out.println(text);
|
|
}
|
|
|
|
private static String getInput(boolean demoContent) {
|
|
if (demoContent) {
|
|
return "Testing, text to make up words. Testing, text without " +
|
|
"specific, up words. Therefore, we don't care about " +
|
|
"arteriscs and other useless symbols, as the only reason" +
|
|
"to use it is when the code runs horrible.";
|
|
} else {
|
|
return receiveText();
|
|
}
|
|
}
|
|
|
|
private static boolean parseArgs(String[] args) {
|
|
boolean demoContent = false;
|
|
|
|
for (String arg : args) {
|
|
if ("-d".equals(arg)) {
|
|
demoContent = true;
|
|
}
|
|
}
|
|
|
|
return demoContent;
|
|
}
|
|
|
|
private static String receiveText() {
|
|
try {
|
|
return Fetcher.fetchTextFromPython();
|
|
} catch (Exception e) {
|
|
return "Testing, text to make up words. Testing, text without " +
|
|
"specific, up words. Therefore, we don't care about " +
|
|
"arteriscs and other useless symbols, as the only reason" +
|
|
"to use it is when the code runs horrible.";
|
|
}
|
|
}
|
|
}
|