示例#1
0
 @Override
 protected int doHashCode() {
   final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(1);
   hash.combine(pid.hashCode(), module.hashCode());
   hash.combine(arity);
   if (md5 != null) {
     hash.combine(md5);
   }
   hash.combine(index);
   hash.combine(uniq);
   if (freeVars != null) {
     for (final OtpErlangObject o : freeVars) {
       hash.combine(o.hashCode(), 1);
     }
   }
   return hash.valueOf();
 }
示例#2
0
  private String parse(OtpErlangObject otpObj) {
    if (otpObj instanceof OtpErlangAtom) {
      OtpErlangAtom atom = (OtpErlangAtom) otpObj;
      if (atom.atomValue().equals("null")) return null;
      else throw new IllegalArgumentException("Only atom null is supported");

    } else if (otpObj instanceof OtpErlangString) {
      OtpErlangString str = (OtpErlangString) otpObj;
      return str.stringValue();
    }
    throw new IllegalArgumentException("Unexpected type " + otpObj.getClass().getName());
  }