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.
 | 
			
		||||
     */
 | 
			
		||||
    public void print(ArrayList<String> text) {
 | 
			
		||||
        if (formatRaw) {
 | 
			
		||||
        if(text.size() == 0) {
 | 
			
		||||
            errorMissingText();
 | 
			
		||||
        }
 | 
			
		||||
        else if (formatRaw) {
 | 
			
		||||
            printFormated(text);
 | 
			
		||||
        } else {
 | 
			
		||||
            toFormat(text);
 | 
			
		||||
| 
						 | 
				
			
			@ -112,8 +115,13 @@ public class TextOutput {
 | 
			
		|||
     * @param index ArrayList with words and in which part they have
 | 
			
		||||
     */
 | 
			
		||||
    public void indexOutput(ArrayList<String> index) {
 | 
			
		||||
        for (String word : index) {
 | 
			
		||||
            System.out.println(word);
 | 
			
		||||
        if(index.size() == 0) {
 | 
			
		||||
            errorMissingText();
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            for (String word : index) {
 | 
			
		||||
                System.out.println(word);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -130,4 +138,11 @@ public class TextOutput {
 | 
			
		|||
    public void errorInvalidCommand() {
 | 
			
		||||
        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