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.
 | 
					     * 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) {
 | 
					    private void createWordlist(HashMap<String,ArrayList<Integer>> wordbook) {
 | 
				
			||||||
        int counter;
 | 
					        int counter;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@ public class TextLogik {
 | 
				
			||||||
                    if (command.length > 1 && "RAW".equals(command[1])) {
 | 
					                    if (command.length > 1 && "RAW".equals(command[1])) {
 | 
				
			||||||
                        checkIfSuccess(textOutput.formatRaw());
 | 
					                        checkIfSuccess(textOutput.formatRaw());
 | 
				
			||||||
                    } else if (command.length > 2 && "FIX".equals(command[1]) && isNumeric(command[2])) {
 | 
					                    } 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 {
 | 
					                    } else {
 | 
				
			||||||
                        textOutput.errorInvalidCommand();
 | 
					                        textOutput.errorInvalidCommand();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,14 +89,14 @@ public class TextOutput {
 | 
				
			||||||
     * @param length the paragraph length when printing the text.
 | 
					     * @param length the paragraph length when printing the text.
 | 
				
			||||||
     * @return returns true if successful and false if and invalid length has been submitted.
 | 
					     * @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) {
 | 
					        if(length > 0) {
 | 
				
			||||||
            formatRaw = false;
 | 
					            formatRaw = false;
 | 
				
			||||||
            columnWidth = length;
 | 
					            columnWidth = length;
 | 
				
			||||||
            return true;
 | 
					            userInfoOutput("Command was successfull");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            return false;
 | 
					            System.err.println("Minimum length has to be greater than 0");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue