Subversion Repositories HomeAutomation

Rev

Rev 15 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

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