Equals() public static method

public static Equals ( object item1, object item2 ) : bool
item1 object
item2 object
return bool
Exemplo n.º 1
0
        public virtual bool IsCopy(Edu.Stanford.Nlp.Ling.IndexedWord otherWord)
        {
            int myInd    = Get(typeof(CoreAnnotations.IndexAnnotation));
            int otherInd = otherWord.Get(typeof(CoreAnnotations.IndexAnnotation));

            if (!Objects.Equals(myInd, otherInd))
            {
                return(false);
            }
            int mySentInd    = Get(typeof(CoreAnnotations.SentenceIndexAnnotation));
            int otherSentInd = otherWord.Get(typeof(CoreAnnotations.SentenceIndexAnnotation));

            if (!Objects.Equals(mySentInd, otherSentInd))
            {
                return(false);
            }
            string myDocID    = GetString <CoreAnnotations.DocIDAnnotation>();
            string otherDocID = otherWord.GetString <CoreAnnotations.DocIDAnnotation>();

            if (!Objects.Equals(myDocID, otherDocID))
            {
                return(false);
            }
            if (CopyCount() == 0 || otherWord.CopyCount() != 0)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            LeastSquareResults other = (LeastSquareResults)obj;

            if (System.BitConverter.DoubleToInt64Bits(_chiSq) != Double.doubleToLongBits(other._chiSq))
            {
                return(false);
            }
            if (!Objects.Equals(_covariance, other._covariance))
            {
                return(false);
            }
            if (!Objects.Equals(_inverseJacobian, other._inverseJacobian))
            {
                return(false);
            }
            return(Objects.Equals(_parameters, other._parameters));
        }
Exemplo n.º 3
0
        /// <summary>Register an Annotator that can be created by the pool.</summary>
        /// <remarks>
        /// Register an Annotator that can be created by the pool.
        /// Note that factories are used here so that many possible annotators can
        /// be defined within the AnnotatorPool, but an Annotator is only created
        /// when one is actually needed.
        /// </remarks>
        /// <param name="name">The name to be associated with the Annotator.</param>
        /// <param name="props">The properties we are using to create the annotator</param>
        /// <param name="annotator">
        /// A factory that creates an instance of the desired Annotator.
        /// This should be an instance of
        /// <see cref="Edu.Stanford.Nlp.Util.Lazy{E}.Cache{E}(Java.Util.Function.ISupplier{T})"/>
        /// , if we want
        /// the annotator pool to behave as a cache (i.e., evict old annotators
        /// when the GC requires it).
        /// </param>
        /// <returns>true if a new annotator was created; false if we reuse an existing one</returns>
        public virtual bool Register(string name, Properties props, Lazy <IAnnotator> annotator)
        {
            bool   newAnnotator = false;
            string newSig       = PropertiesUtils.GetSignature(name, props);

            lock (this.cachedAnnotators)
            {
                AnnotatorPool.CachedAnnotator oldAnnotator = this.cachedAnnotators[name];
                if (oldAnnotator == null || !Objects.Equals(oldAnnotator.signature, newSig))
                {
                    // the new annotator uses different properties so we need to update!
                    if (oldAnnotator != null)
                    {
                        // Try to get it from the global cache
                        log.Debug("Replacing old annotator \"" + name + "\" with signature [" + oldAnnotator.signature + "] with new annotator with signature [" + newSig + "]");
                    }
                    // Add the new annotator
                    this.cachedAnnotators[name] = new AnnotatorPool.CachedAnnotator(newSig, annotator);
                    // Unmount the old annotator
                    Optional.OfNullable(oldAnnotator).FlatMap(null).IfPresent(null);
                    // Register that we added an annotator
                    newAnnotator = true;
                }
            }
            // nothing to do if an annotator with same name and signature already exists
            return(newAnnotator);
        }
Exemplo n.º 4
0
        public bool Equals(SaveFileGTA3 other)
        {
            if (other == null)
            {
                return(false);
            }

            return(SimpleVars.Equals(other.SimpleVars) &&
                   Scripts.Equals(other.Scripts) &&
                   PlayerPeds.Equals(other.PlayerPeds) &&
                   Garages.Equals(other.Garages) &&
                   Vehicles.Equals(other.Vehicles) &&
                   Objects.Equals(other.Objects) &&
                   Paths.Equals(other.Paths) &&
                   Cranes.Equals(other.Cranes) &&
                   Pickups.Equals(other.Pickups) &&
                   PhoneInfo.Equals(other.PhoneInfo) &&
                   RestartPoints.Equals(other.RestartPoints) &&
                   RadarBlips.Equals(other.RadarBlips) &&
                   Zones.Equals(other.Zones) &&
                   Gangs.Equals(other.Gangs) &&
                   CarGenerators.Equals(other.CarGenerators) &&
                   ParticleObjects.Equals(other.ParticleObjects) &&
                   AudioScriptObjects.Equals(other.AudioScriptObjects) &&
                   PlayerInfo.Equals(other.PlayerInfo) &&
                   Stats.Equals(other.Stats) &&
                   Streaming.Equals(other.Streaming) &&
                   PedTypeInfo.Equals(other.PedTypeInfo));
        }
Exemplo n.º 5
0
 public override bool Equals(object another)
 {
     return(another is StoragePolicySummary.StorageTypeAllocation && Objects.Equals(specifiedStoragePolicy
                                                                                    , ((StoragePolicySummary.StorageTypeAllocation)another).specifiedStoragePolicy) &&
            Arrays.Equals(storageTypes, ((StoragePolicySummary.StorageTypeAllocation)another
                                         ).storageTypes));
 }
Exemplo n.º 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void dump(String database, org.neo4j.io.layout.DatabaseLayout databaseLayout, java.nio.file.Path transactionalLogsDirectory, java.nio.file.Path archive) throws org.neo4j.commandline.admin.CommandFailed
        private void Dump(string database, DatabaseLayout databaseLayout, Path transactionalLogsDirectory, Path archive)
        {
            Path databasePath = databaseLayout.DatabaseDirectory().toPath();

            try
            {
                File storeLockFile = databaseLayout.StoreLayout.storeLockFile();
                System.Predicate <Path> pathPredicate = path => Objects.Equals(path.FileName.ToString(), storeLockFile.Name);
                _dumper.dump(databasePath, transactionalLogsDirectory, archive, CompressionFormat.ZSTD, pathPredicate);
            }
            catch (FileAlreadyExistsException e)
            {
                throw new CommandFailed("archive already exists: " + e.Message, e);
            }
            catch (NoSuchFileException e)
            {
                if (Paths.get(e.Message).toAbsolutePath().Equals(databasePath))
                {
                    throw new CommandFailed("database does not exist: " + database, e);
                }
                WrapIOException(e);
            }
            catch (IOException e)
            {
                WrapIOException(e);
            }
        }
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            UncoupledParameterTransforms other = (UncoupledParameterTransforms)obj;

            if (!Arrays.Equals(_freeParameters, other._freeParameters))
            {
                return(false);
            }
            if (!Objects.Equals(_startValues, other._startValues))
            {
                return(false);
            }
            return(Arrays.Equals(_transforms, other._transforms));
        }
Exemplo n.º 8
0
        public bool AreEqual <T>(T first, T second, Func <string> messageProducer)
        {
            bool areEqual = Objects.Equals(first, second);

            FailIfFalse(areEqual, messageProducer);
            return(areEqual);
        }
Exemplo n.º 9
0
        public bool AreNotEqual <T>(T first, T second, Func <string> messageProducer) where T : IEquatable <T>
        {
            bool areNotEqual = !Objects.Equals(first, second);

            FailIfFalse(areNotEqual, messageProducer);
            return(areNotEqual);
        }
Exemplo n.º 10
0
        public override bool Equals(object other)
        {
            RemovalNotification <K, V> notification = other as RemovalNotification <K, V>;

            if (!ReferenceEquals(notification, null))
            {
                return(Objects.Equals(Key, notification.Key) && Objects.Equals(Value, notification.Value));
            }
            return(false);
        }
Exemplo n.º 11
0
        public override void HandleStepDown(long term, string dbName)
        {
            LeaderInfo localLeaderInfo = Leader;

            bool wasLeaderForDbAndTerm = Objects.Equals(MyselfConflict, localLeaderInfo.MemberId()) && LocalDBName().Equals(dbName) && term == localLeaderInfo.Term();

            if (wasLeaderForDbAndTerm)
            {
                Log.info("Step down event detected. This topology member, with MemberId %s, was leader in term %s, now moving " + "to follower.", MyselfConflict, localLeaderInfo.Term());
                HandleStepDown0(localLeaderInfo.StepDown());
            }
        }
Exemplo n.º 12
0
 //-------------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (this == obj)
     {
       return true;
     }
     if (obj == null || this.GetType() != obj.GetType())
     {
       return false;
     }
     TestObservableId that = (TestObservableId) obj;
     return Objects.Equals(id, that.id);
 }
Exemplo n.º 13
0
 //-------------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (this == obj)
     {
         return(true);
     }
     if (obj is TestingNamedId)
     {
         TestingNamedId other = (TestingNamedId)obj;
         return(Objects.Equals(name, other.name));
     }
     return(false);
 }
Exemplo n.º 14
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Checks if this element equals another.
 /// <para>
 /// This compares the entire state of the element, including all children.
 ///
 /// </para>
 /// </summary>
 /// <param name="obj">  the other element, null returns false </param>
 /// <returns> true if equal </returns>
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj is XmlElement)
     {
         XmlElement other = (XmlElement)obj;
         return(name.Equals(other.name) && Objects.Equals(content, other.content) && attributes.Equals(other.attributes) && children.Equals(other.children));
     }
     return(false);
 }
Exemplo n.º 15
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            TestSimpleId that = (TestSimpleId)o;

            return(Objects.Equals(id, that.id) && Objects.Equals(observableSource, that.observableSource));
        }
Exemplo n.º 16
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            InitialMagicMessage that = ( InitialMagicMessage )o;

            return(Objects.Equals(_magic, that._magic));
        }
Exemplo n.º 17
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            FieldSignature that = ( FieldSignature )o;

            return(_name.Equals(that._name) && _type.Equals(that._type) && Objects.Equals(this._defaultValue, that._defaultValue) && this._deprecated == that._deprecated);
        }
Exemplo n.º 18
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            FilteringPolicy that = ( FilteringPolicy )o;

            return(Objects.Equals(_filter, that._filter));
        }
Exemplo n.º 19
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            FileHeader that = ( FileHeader )o;

            return(_requiredAlignment == that._requiredAlignment && Objects.Equals(_fileName, that._fileName));
        }
Exemplo n.º 20
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            BaseProtocolRequest that = ( BaseProtocolRequest )o;

            return(Objects.Equals(_protocolName, that._protocolName) && Objects.Equals(_versions, that._versions));
        }
Exemplo n.º 21
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            LockResult that = ( LockResult )o;

            return(Objects.Equals(_status, that._status) && Objects.Equals(_message, that._message));
        }
Exemplo n.º 22
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            RunMessage that = ( RunMessage )o;

            return(Objects.Equals(_statement, that._statement) && Objects.Equals(@params, that.@params) && Objects.Equals(_meta, that._meta));
        }
Exemplo n.º 23
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            GlobalSessionTrackerState that = ( GlobalSessionTrackerState )o;

            return(_logIndex == that._logIndex && Objects.Equals(_sessionTrackers, that._sessionTrackers));
        }
Exemplo n.º 24
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            InMemoryRaftLog that = ( InMemoryRaftLog )o;

            return(Objects.Equals(_appendIndex, that._appendIndex) && Objects.Equals(_commitIndex, that._commitIndex) && Objects.Equals(_term, that._term) && Objects.Equals(_raftLog, that._raftLog));
        }
Exemplo n.º 25
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            StoreLayout that = ( StoreLayout )o;

            return(Objects.Equals(_storeDirectory, that._storeDirectory));
        }
Exemplo n.º 26
0
            public override bool Equals(object o)
            {
                if (this == o)
                {
                    return(true);
                }
                if (o == null || this.GetType() != o.GetType())
                {
                    return(false);
                }
                ThresholdConfigValue that = ( ThresholdConfigValue )o;

                return(Value == that.Value && Objects.Equals(Type, that.Type));
            }
Exemplo n.º 27
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            LeaderInfo that = ( LeaderInfo )o;

            return(_term == that._term && _isSteppingDown == that._isSteppingDown && Objects.Equals(_memberId, that._memberId));
        }
Exemplo n.º 28
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            ReadReplicaTopology that = ( ReadReplicaTopology )o;

            return(Objects.Equals(_readReplicaMembers, that._readReplicaMembers));
        }
Exemplo n.º 29
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            BeginMessage that = ( BeginMessage )o;

            return(Objects.Equals(_meta, that._meta));
        }
Exemplo n.º 30
0
        //-------------------------------------------------------------------------
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null || this.GetType() != obj.GetType())
            {
                return(false);
            }
            TestingReferenceDataId that = (TestingReferenceDataId)obj;

            return(Objects.Equals(id, that.id));
        }