-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariable.java
More file actions
35 lines (28 loc) · 810 Bytes
/
Variable.java
File metadata and controls
35 lines (28 loc) · 810 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
public final class Variable extends AbstractListSymbol implements ListSymbol, TreeSymbol {
private final String representation;
private Variable(String representation) {
this.representation = representation;
}
//Throws an error if the String inputted is null
public static final Variable build(String representation){
if(representation != null)
return new Variable(representation);
else
throw new NullPointerException("Cannot build a Variable object with null String value");
}
public final String getRepresentation() {
return representation;
}
@Override
public String toString(){
return this.getRepresentation();
}
@Override
public Type getType() {
return Type.VARIABLE;
}
@Override
public long complexity() {
return 0;
}
}