node() public method

public node ( ) : System.String
return System.String
示例#1
0
文件: Ref.cs 项目: yonglehou/otp.net
        /*
         * Create an Erlang ref from a stream containing a ref encoded in
         * Erlang external format.
         *
         * @param buf the stream containing the encoded ref.
         *
         * @exception DecodeException if the buffer does not
         * contain a valid external representation of an Erlang ref.
         **/
        public Ref(OtpInputStream buf)
        {
            Ref r = buf.read_ref();

            this._node     = r.node();
            this._creation = r.creation();

            this._ids = r.ids();
        }
示例#2
0
文件: Ref.cs 项目: yonglehou/otp.net
        /*
         * Determine if two refs are equal. Refs are equal if their
         * components are equal. New refs and old refs are considered equal
         * if the node, creation and first id numnber are equal.
         *
         * @param o the other ref to compare to.
         *
         * @return true if the refs are equal, false otherwise.
         **/
        public override bool Equals(System.Object o)
        {
            if (!(o is Ref))
            {
                return(false);
            }


            Ref ref_Renamed = (Ref)o;

            if (!(this._node.Equals(ref_Renamed.node()) && this._creation == ref_Renamed.creation()))
            {
                return(false);
            }

            if (this.isNewRef() && ref_Renamed.isNewRef())
            {
                return(this._ids[0] == ref_Renamed._ids[0] && this._ids[1] == ref_Renamed._ids[1] && this._ids[2] == ref_Renamed._ids[2]);
            }
            return(this._ids[0] == ref_Renamed._ids[0]);
        }
示例#3
0
 public int encode_size(Erlang.Object o)
 {
     if (o is Erlang.Atom)
     {
         return(1 + 2 + o.atomValue().Length);
     }
     else if (o is Erlang.Boolean)
     {
         return(1 + 2 + (o.boolValue()
                                               ? Erlang.Boolean.s_true.atomValue().Length
                                               : Erlang.Boolean.s_false.atomValue().Length));
     }
     else if (o is Erlang.Binary)
     {
         return(5 + o.binaryValue().Length);
     }
     else if (o is Erlang.Long)
     {
         long l = o.longValue();
         if ((l & 0xff) == l)
         {
             return(2);
         }
         else if ((l <= OtpExternal.erlMax) && (l >= OtpExternal.erlMin))
         {
             return(5);
         }
         return(long_arity(l));
     }
     else if (o is Erlang.Byte)
     {
         return(1 + 1);
     }
     else if (o is Erlang.Double)
     {
         return(9);
     }
     else if (o is Erlang.String)
     {
         string l = o.stringValue();
         if (l.Length == 0)
         {
             return(1);
         }
         if (l.Length < 0xffff)
         {
             return(2 + l.Length);
         }
         return(1 + 4 + 2 * l.Length);
     }
     else if (o is Erlang.List)
     {
         Erlang.List l = o.listValue();
         if (l.arity() == 0)
         {
             return(1);
         }
         int sz = 5;
         for (int i = 0; i < l.arity(); i++)
         {
             sz += encode_size(l[i]);
         }
         return(sz);
     }
     else if (o is Erlang.Tuple)
     {
         Erlang.Tuple l  = o.tupleValue();
         int          sz = 1 + (l.arity() < 0xff ? 1 : 4);
         for (int i = 0; i < l.arity(); i++)
         {
             sz += encode_size(l[i]);
         }
         return(sz);
     }
     else if (o is Erlang.Pid)
     {
         Erlang.Pid p = o.pidValue();
         return(1 + (1 + 2 + p.node().Length) + 4 + 4 + 1);
     }
     else if (o is Erlang.Ref)
     {
         Erlang.Ref p   = o.refValue();
         int[]      ids = p.ids();
         return(1 + (1 + 2 + p.node().Length) + 1 + 4 * ids.Length);
     }
     else if (o is Erlang.Port)
     {
         Erlang.Port p = o.portValue();
         return(1 + (1 + 2 + p.node().Length) + 4 + 1);
     }
     else
     {
         throw new Erlang.Exception("Unknown encode size for object: " + o.ToString());
     }
 }