Example #1
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }

            MemberIsAvailable that = ( MemberIsAvailable )o;

            if (!_clusterUri.Equals(that._clusterUri))
            {
                return(false);
            }
            if (!_instanceId.Equals(that._instanceId))
            {
                return(false);
            }
            if (!_role.Equals(that._role))
            {
                return(false);
            }
            return(_roleUri.Equals(that._roleUri));
        }
Example #2
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }

            CommonContextState that = ( CommonContextState )o;

            if (_lastKnownLearnedInstanceInCluster != that._lastKnownLearnedInstanceInCluster)
            {
                return(false);
            }
            if (_nextInstanceId != that._nextInstanceId)
            {
                return(false);
            }
            if (_boundAt != null ?!_boundAt.Equals(that._boundAt) : that._boundAt != null)
            {
                return(false);
            }
            return(_configuration != null?_configuration.Equals(that._configuration) : that._configuration == null);
        }
Example #3
0
        public virtual void Joined(InstanceId joinedInstanceId, URI instanceUri)
        {
            if (instanceUri.Equals(_members[joinedInstanceId]))
            {
                return;                         // Already know that this node is in - ignore
            }

            IDictionary <InstanceId, URI> newMembers = new Dictionary <InstanceId, URI>(_members);

            newMembers[joinedInstanceId] = instanceUri;
            _members = newMembers;
        }
Example #4
0
        /// <exception cref="URISyntaxException"/>
        /// <exception cref="System.IO.IOException"/>
        public virtual void TestURI()
        {
            URI  uri  = new URI("file:///bar#baz");
            Path path = new Path(uri);

            Assert.True(uri.Equals(new URI(path.ToString())));
            FileSystem fs = path.GetFileSystem(new Configuration());

            Assert.True(uri.Equals(new URI(fs.MakeQualified(path).ToString(
                                               ))));
            // uri without hash
            URI uri2 = new URI("file:///bar/baz");

            Assert.True(uri2.Equals(new URI(fs.MakeQualified(new Path(uri2)
                                                             ).ToString())));
            Assert.Equal("foo://bar/baz#boo", new Path("foo://bar/", new Path
                                                           (new URI("/baz#boo"))).ToString());
            Assert.Equal("foo://bar/baz/fud#boo", new Path(new Path(new URI
                                                                        ("foo://bar/baz#bud")), new Path(new URI("fud#boo"))).ToString());
            // if the child uri is absolute path
            Assert.Equal("foo://bar/fud#boo", new Path(new Path(new URI("foo://bar/baz#bud"
                                                                        )), new Path(new URI("/fud#boo"))).ToString());
        }
        /// <summary>Removes a URI from the collection.</summary>
        /// <remarks>Removes a URI from the collection.</remarks>
        public virtual bool Remove(URI uri)
        {
            bool removed = this.unique.Remove(uri);

            if (removed)
            {
                IEnumerator <URI> it = this.all.GetEnumerator();
                while (it.HasNext())
                {
                    URI current = it.Next();
                    if (current.Equals(uri))
                    {
                        it.Remove();
                    }
                }
            }
            return(removed);
        }