added unique error message to invalid format length
This commit is contained in:
parent
547db94893
commit
8225111671
|
@ -166,7 +166,6 @@ public class Text {
|
|||
/**
|
||||
* This method counts all Words in text and adds the count together with the paragraph where the word is been used to a Hashmap.
|
||||
*
|
||||
* @return HashMap<String, ArrayList < Integer>>
|
||||
*/
|
||||
private void createWordlist(HashMap<String,ArrayList<Integer>> wordbook) {
|
||||
int counter;
|
||||
|
|
|
@ -62,7 +62,7 @@ public class TextLogik {
|
|||
if (command.length > 1 && "RAW".equals(command[1])) {
|
||||
checkIfSuccess(textOutput.formatRaw());
|
||||
} else if (command.length > 2 && "FIX".equals(command[1]) && isNumeric(command[2])) {
|
||||
checkIfSuccess(textOutput.formatFix(Integer.parseInt(command[2])));
|
||||
textOutput.formatFix(Integer.parseInt(command[2]));
|
||||
} else {
|
||||
textOutput.errorInvalidCommand();
|
||||
}
|
||||
|
|
|
@ -89,14 +89,14 @@ public class TextOutput {
|
|||
* @param length the paragraph length when printing the text.
|
||||
* @return returns true if successful and false if and invalid length has been submitted.
|
||||
*/
|
||||
public boolean formatFix(int length) {
|
||||
public void formatFix(int length) {
|
||||
if(length > 0) {
|
||||
formatRaw = false;
|
||||
columnWidth = length;
|
||||
return true;
|
||||
userInfoOutput("Command was successfull");
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
System.err.println("Minimum length has to be greater than 0");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue