added error method missing text and implemented indexOutput and print to throw it when empty
This commit is contained in:
		
							parent
							
								
									3e2bfbaf42
								
							
						
					
					
						commit
						fc2df13790
					
				| 
						 | 
					@ -14,7 +14,10 @@ public class TextOutput {
 | 
				
			||||||
     * @param text the ArrayList which is then formatted into the desired output.
 | 
					     * @param text the ArrayList which is then formatted into the desired output.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public void print(ArrayList<String> text) {
 | 
					    public void print(ArrayList<String> text) {
 | 
				
			||||||
        if (formatRaw) {
 | 
					        if(text.size() == 0) {
 | 
				
			||||||
 | 
					            errorMissingText();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if (formatRaw) {
 | 
				
			||||||
            printFormated(text);
 | 
					            printFormated(text);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            toFormat(text);
 | 
					            toFormat(text);
 | 
				
			||||||
| 
						 | 
					@ -112,8 +115,13 @@ public class TextOutput {
 | 
				
			||||||
     * @param index ArrayList with words and in which part they have
 | 
					     * @param index ArrayList with words and in which part they have
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public void indexOutput(ArrayList<String> index) {
 | 
					    public void indexOutput(ArrayList<String> index) {
 | 
				
			||||||
        for (String word : index) {
 | 
					        if(index.size() == 0) {
 | 
				
			||||||
            System.out.println(word);
 | 
					            errorMissingText();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					            for (String word : index) {
 | 
				
			||||||
 | 
					                System.out.println(word);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -130,4 +138,11 @@ public class TextOutput {
 | 
				
			||||||
    public void errorInvalidCommand() {
 | 
					    public void errorInvalidCommand() {
 | 
				
			||||||
        System.err.println("Invalid Command");
 | 
					        System.err.println("Invalid Command");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Method to give out the Error "Missing Text".
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public void errorMissingText() {
 | 
				
			||||||
 | 
					        System.err.println("Missing Text");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue