Subversion Repositories HomeAutomation

Rev

Go to most recent revision | Blame | Last modification | View Log | SVN | RSS feed

  1. /*
  2.  * RepeatedString.java
  3.  *
  4.  * Created on den 23 augusti 2003, 17:37
  5.  */
  6. package Macbeth.Utilities;
  7.  
  8. /**
  9.  * Repeats a String a given number of times
  10.  * @author Jimmy
  11.  */
  12. public class RepeatedString {
  13.     //The actual String
  14.     private String str;
  15.  
  16.     /**
  17.      * Creates a new instance of RepeatedString.
  18.      * @param repeatString The String that should be repeated.
  19.      * @param repeatCount How many times the String should be repeated.
  20.      */
  21.     public RepeatedString(String repeatString, int repeatCount) {
  22.         str = new String();
  23.         for (int i=0; i<repeatCount; i++) {
  24.             str += repeatString;
  25.         }
  26.     }
  27.  
  28.     /**
  29.      * Gets the repeated string.
  30.      * @return The repeated string as a String.
  31.      */
  32.     public String toString() {
  33.         return str;
  34.     }
  35. }
  36.