/** @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { if (!(o instanceof ActivationRecord)) return false; ActivationRecord oar = (ActivationRecord) o; Set<String> keys = keySet(); for (String s : keys) if (!lookup(s).equals(oar.lookup(s))) return false; return true; }
/** @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); for (String s : _mappings.keySet()) sb.append("{" + s + " : " + _mappings.get(s) + "}"); return _previous.toString() + sb.toString(); }
/** @return This method returns a list of al the keys in this activation record. */ public Set<String> keySet() { Set<String> belowset = _previous.keySet(); belowset.addAll(_mappings.keySet()); return belowset; }
/** * @return This method returns a mapping of all bindings in this activation record and others * higher up the static chain, excluding the top (end) activation record. This value should * not be viewed as a representative collection of bindings -- this only contains the * extensions to the activation record. This is useful if you'd like to serialize the * activation record but leave out all the huge values (like sets, dags) that every other node * can independently construct. */ protected HashMap<String, Value> extensions() { HashMap<String, Value> belowset = _previous.extensions(); belowset.putAll(_mappings); return belowset; }
/** * Lookup a variable binding in the environment. * * @param name Lookup this identifier * @return This method returns the value that the given identifier is bound to. * @throws NotFoundException This method throws if the given variable is not bound in the target * environment. */ public Value lookup(String name) throws NotFoundException { if (_mappings.containsKey(name)) return _mappings.get(name); return _previous.lookup(name); }