示例#1
0
    public override int CompareTo(IceInternal.EndpointI obj)
    {
        EndpointI p = null;

        try
        {
            p = (EndpointI)obj;
        }
        catch (System.InvalidCastException)
        {
            try
            {
                return(type() < obj.type() ? -1 : 1);
            }
            catch (System.InvalidCastException)
            {
                Debug.Assert(false);
            }
        }

        if (this == p)
        {
            return(0);
        }

        return(_endpoint.CompareTo(p._endpoint));
    }
示例#2
0
        public override int CompareTo(EndpointI obj)
        {
            if (!(obj is TcpEndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            TcpEndpointI p = (TcpEndpointI)obj;

            if (this == p)
            {
                return(0);
            }

            if (_timeout < p._timeout)
            {
                return(-1);
            }
            else if (p._timeout < _timeout)
            {
                return(1);
            }

            if (!_compress && p._compress)
            {
                return(-1);
            }
            else if (!p._compress && _compress)
            {
                return(1);
            }

            return(base.CompareTo(p));
        }
示例#3
0
        //
        // Compare endpoints for sorting purposes
        //
        public override int CompareTo(EndpointI obj)
        {
            if (!(obj is TcpEndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            TcpEndpointI p = (TcpEndpointI)obj;

            if (this == p)
            {
                return(0);
            }
            else
            {
                int r = base.CompareTo(p);
                if (r != 0)
                {
                    return(r);
                }
            }

            if (_port < p._port)
            {
                return(-1);
            }
            else if (p._port < _port)
            {
                return(1);
            }

            if (_timeout < p._timeout)
            {
                return(-1);
            }
            else if (p._timeout < _timeout)
            {
                return(1);
            }

            if (!_compress && p._compress)
            {
                return(-1);
            }
            else if (!p._compress && _compress)
            {
                return(1);
            }

            return(string.Compare(_host, p._host, StringComparison.Ordinal));
        }
示例#4
0
        //
        // Compare endpoints for sorting purposes
        //
        public override int CompareTo(EndpointI obj)
        {
            if (!(obj is UdpEndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            UdpEndpointI p = (UdpEndpointI)obj;

            if (this == p)
            {
                return(0);
            }

            if (!_connect && p._connect)
            {
                return(-1);
            }
            else if (!p._connect && _connect)
            {
                return(1);
            }

            if (!_compress && p._compress)
            {
                return(-1);
            }
            else if (!p._compress && _compress)
            {
                return(1);
            }

            int rc = string.Compare(_mcastInterface, p._mcastInterface, StringComparison.Ordinal);

            if (rc != 0)
            {
                return(rc);
            }

            if (_mcastTtl < p._mcastTtl)
            {
                return(-1);
            }
            else if (p._mcastTtl < _mcastTtl)
            {
                return(1);
            }

            return(base.CompareTo(p));
        }
示例#5
0
    public override int CompareTo(IceInternal.EndpointI obj)
    {
        if (ReferenceEquals(this, obj))
        {
            return(0);
        }

        if (!(obj is EndpointI))
        {
            return(type() < obj.type() ? -1 : 1);
        }

        return(_endpoint.CompareTo(((EndpointI)obj)._endpoint));
    }
示例#6
0
        public override int CompareTo(EndpointI obj)
        {
            if (!(obj is IPEndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            IPEndpointI p = (IPEndpointI)obj;

            if (this == p)
            {
                return(0);
            }

            int v = string.Compare(host_, p.host_, StringComparison.Ordinal);

            if (v != 0)
            {
                return(v);
            }

            if (port_ < p.port_)
            {
                return(-1);
            }
            else if (p.port_ < port_)
            {
                return(1);
            }

            int rc = string.Compare(Network.endpointAddressToString(sourceAddr_),
                                    Network.endpointAddressToString(p.sourceAddr_), StringComparison.Ordinal);

            if (rc != 0)
            {
                return(rc);
            }

            return(string.Compare(connectionId_, p.connectionId_, StringComparison.Ordinal));
        }
示例#7
0
        public override int CompareTo(EndpointI obj)
        {
            if (!(obj is EndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            WSEndpoint p = (WSEndpoint)obj;

            if (this == p)
            {
                return(0);
            }

            int v = string.Compare(_resource, p._resource, StringComparison.Ordinal);

            if (v != 0)
            {
                return(v);
            }

            return(_delegate.CompareTo(p._delegate));
        }
示例#8
0
        //
        // Compare endpoints for sorting purposes
        //
        public override int CompareTo(EndpointI obj)
        {
            if (!(obj is OpaqueEndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            OpaqueEndpointI p = (OpaqueEndpointI)obj;

            if (this == p)
            {
                return(0);
            }

            if (_type < p._type)
            {
                return(-1);
            }
            else if (p._type < _type)
            {
                return(1);
            }

            if (_rawEncoding.major < p._rawEncoding.major)
            {
                return(-1);
            }
            else if (p._rawEncoding.major < _rawEncoding.major)
            {
                return(1);
            }

            if (_rawEncoding.minor < p._rawEncoding.minor)
            {
                return(-1);
            }
            else if (p._rawEncoding.minor < _rawEncoding.minor)
            {
                return(1);
            }

            if (_rawBytes.Length < p._rawBytes.Length)
            {
                return(-1);
            }
            else if (p._rawBytes.Length < _rawBytes.Length)
            {
                return(1);
            }
            for (int i = 0; i < _rawBytes.Length; i++)
            {
                if (_rawBytes[i] < p._rawBytes[i])
                {
                    return(-1);
                }
                else if (p._rawBytes[i] < _rawBytes[i])
                {
                    return(1);
                }
            }

            return(0);
        }
示例#9
0
        //
        // Compare endpoints for sorting purposes
        //
        public override int CompareTo(EndpointI obj)
        {
            if (!(obj is UdpEndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            UdpEndpointI p = (UdpEndpointI)obj;

            if (this == p)
            {
                return(0);
            }
            else
            {
                int r = base.CompareTo(p);
                if (r != 0)
                {
                    return(r);
                }
            }

            if (_port < p._port)
            {
                return(-1);
            }
            else if (p._port < _port)
            {
                return(1);
            }

            if (!_connect && p._connect)
            {
                return(-1);
            }
            else if (!p._connect && _connect)
            {
                return(1);
            }

            if (!connectionId_.Equals(p.connectionId_))
            {
                return(string.Compare(connectionId_, p.connectionId_, StringComparison.Ordinal));
            }

            if (!_compress && p._compress)
            {
                return(-1);
            }
            else if (!p._compress && _compress)
            {
                return(1);
            }

            int rc = string.Compare(_mcastInterface, p._mcastInterface, StringComparison.Ordinal);

            if (rc != 0)
            {
                return(rc);
            }

            if (_mcastTtl < p._mcastTtl)
            {
                return(-1);
            }
            else if (p._mcastTtl < _mcastTtl)
            {
                return(1);
            }

            return(string.Compare(_host, p._host, StringComparison.Ordinal));
        }