package gw.util /** * Helper class for objects that can alternatively be referenced by a key or identifier. */ abstract class NamedRef { var _instance : T as readonly Instance var _code : C as readonly Code private construct() { } construct(objCode : C) { _instance = null _code = objCode } /** * Subclasses should implement construct(instance : T), which should * call this constructor. */ protected construct(obj : T, objCode : C) { _instance = obj _code = objCode } abstract property get DisplayName() : String // Pebbles uses this as the Value property for RangeInput items override function toString() : String { return this.Code != null ? this.Code.toString() : "" } override function equals(other: Object) : boolean { if (this === other) { return true } if (other typeis NamedRef) { return other.Code == this.Code } return false } override function hashCode() : int { return this.Code != null ? this.Code.hashCode() : 0 } }