-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIdentifier.java
More file actions
43 lines (33 loc) · 827 Bytes
/
Identifier.java
File metadata and controls
43 lines (33 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package assignment1;
import java.lang.StringBuffer;
public class Identifier implements IdentifierInterface {
private StringBuffer identifier;
Identifier() {
identifier = new StringBuffer();
}
Identifier(Identifier src) {
this();
identifier.append(src.identifier);
}
@Override
public void init(char c) {
identifier.delete(0, identifier.length());
identifier.append(c);
}
@Override
public void add(char c) {
identifier.append(c);
}
@Override
public int size() {
return identifier.length();
}
@Override
public boolean equals(Identifier comparand) {
return this.get().compareTo(comparand.get()) == 0;
}
@Override
public String get() {
return identifier.toString();
}
}