add context analysis and custom visitors
This commit is contained in:
@@ -1,55 +1,13 @@
|
||||
package de.hsrm.compiler.Klang;
|
||||
|
||||
public class Value {
|
||||
private Object value;
|
||||
|
||||
public static Value VOID = new Value(new Object());
|
||||
public Value(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
final Object value;
|
||||
|
||||
public Value(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer asInteger() {
|
||||
return (Integer)value;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public boolean isDouble() {
|
||||
return value instanceof Double;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
if(value == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.value.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
if(value == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(value == null || o == null || o.getClass() != value.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Value that = (Value)o;
|
||||
|
||||
return this.value.equals(that.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
public int asInteger() {
|
||||
return (int) this.value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user