parent
							
								
									daa403cac0
								
							
						
					
					
						commit
						fae2728444
					
				| 
						 | 
				
			
			@ -25,6 +25,14 @@ public class Text {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Method to check if a specific Paragraph exists
 | 
			
		||||
     * @param paragraphNumber to number of the paragraph which should be checked
 | 
			
		||||
     * @return returns true if the paragraph exists
 | 
			
		||||
     */
 | 
			
		||||
    private boolean paragraphExists(int paragraphNumber) {
 | 
			
		||||
        return ((paragraphNumber > 0) && (paragraphNumber <= this.text.size()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Method to add a paragraph at a specific position.
 | 
			
		||||
| 
						 | 
				
			
			@ -33,7 +41,7 @@ public class Text {
 | 
			
		|||
     * @return returns true if the given paragraph exists and is added successfully
 | 
			
		||||
     */
 | 
			
		||||
    public boolean add(int paragraphNumber, String text) {
 | 
			
		||||
        if(paragraphNumber > 0 && (paragraphNumber <= this.text.size())) {
 | 
			
		||||
        if(paragraphExists(paragraphNumber)) {
 | 
			
		||||
            this.text.add((paragraphNumber - 1), text);
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -75,7 +83,7 @@ public class Text {
 | 
			
		|||
     * @return returns true if the given paragraph exists and is changed successfully
 | 
			
		||||
     */
 | 
			
		||||
    public boolean replace(int paragraphNumber, String oldChar, String newChar) {
 | 
			
		||||
        if(paragraphNumber > 0 && (paragraphNumber <= this.text.size())) {
 | 
			
		||||
        if(paragraphExists(paragraphNumber)) {
 | 
			
		||||
            text.set((paragraphNumber - 1), text.get(paragraphNumber - 1).replace(oldChar, newChar));
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +103,7 @@ public class Text {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
    public boolean del(int paragraphNumber) {
 | 
			
		||||
        if(paragraphNumber > 0 && (paragraphNumber <= this.text.size())) {
 | 
			
		||||
        if(paragraphExists(paragraphNumber)) {
 | 
			
		||||
            //paragraph hier löschen.
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue