1 package org.simantics.scl.compiler.dynamic;
3 import org.simantics.scl.compiler.types.Type;
5 public class SafeDynamic {
6 public final Type type_;
7 public final Object value;
9 public SafeDynamic(Type type_, Object value) {
14 public String toString() {
15 return new StringBuilder().append("(SafeDynamic").append(" ").append((Object)this.type_).append(" ").append(this.value).append(")").toString();
18 public boolean equals(Object other) {
21 if(other == null || !other.getClass().equals(SafeDynamic.class))
23 SafeDynamic dyn = (SafeDynamic)other;
24 return type_.equals(dyn.type_) && (value == null ? dyn.value == null : value.equals(dyn.value));
27 public int hashCode() {
28 return 31*type_.hashCode()+(value==null ? -957171758 : value.hashCode());