boolean symbolKeys = hasSymbolKeys(map); for (final Map.Entry<OtpErlangObject, OtpErlangObject> e : map.entrySet()) { OtpErlangObject key = e.getKey(); if (!(isStruct(map) && key instanceof OtpErlangAtom && ((OtpErlangAtom) key).atomValue().equals("__struct__"))) {
/** * Get the string representation of the map. * * @return the string representation of the map. */ @Override public String toString() { final StringBuffer s = new StringBuffer(); s.append("#{"); boolean first = true; for (final Map.Entry<OtpErlangObject, OtpErlangObject> e : entrySet()) { if (first) { first = false; } else { s.append(","); } s.append(e.getKey().toString()); s.append(" => "); s.append(e.getValue().toString()); } s.append("}"); return s.toString(); }
@Override public <T> OtpErlangObject bind(final T binds) throws OtpErlangException { final OtpErlangMap ret = new OtpErlangMap(); OtpErlangObject key, val; for (final Map.Entry<OtpErlangObject, OtpErlangObject> e : entrySet()) { key = e.getKey(); val = e.getValue(); ret.put(key, val.bind(binds)); } return ret; }
/** * Convert this map to the equivalent Erlang external representation. * * @param buf * an output stream to which the encoded map should be written. */ @Override public void encode(final OtpOutputStream buf) { final int arity = arity(); buf.write_map_head(arity); for (final Map.Entry<OtpErlangObject, OtpErlangObject> e : entrySet()) { buf.write_any(e.getKey()); buf.write_any(e.getValue()); } }
@Override public <T> boolean match(final OtpErlangObject term, final T binds) { if (!(term instanceof OtpErlangMap)) { return false; } final OtpErlangMap t = (OtpErlangMap) term; final int a = arity(); if (a > t.arity()) { return false; } if (a == 0) { return true; } OtpErlangObject key, val; for (final Map.Entry<OtpErlangObject, OtpErlangObject> e : entrySet()) { key = e.getKey(); val = e.getValue(); final OtpErlangObject v = t.get(key); if (v == null || !val.match(v, binds)) { return false; } } return true; }
for (final Map.Entry<OtpErlangObject, OtpErlangObject> e : entrySet()) { key = e.getKey(); val = e.getValue();