public override bool Equals(object o) { if (this == o) { return(true); } if (o == null || GetType() != o.GetType()) { return(false); } Site site = (Site)o; if (CycleRetryTimes != site.CycleRetryTimes) { return(false); } if (RetryTimes != site.RetryTimes) { return(false); } if (SleepTime != site.SleepTime) { return(false); } if (Timeout != site.Timeout) { return(false); } if (!AcceptStatCode?.Equals(site.AcceptStatCode) ?? site.AcceptStatCode != null) { return(false); } if (!Encoding?.Equals(site.Encoding) ?? site.Encoding != null) { return(false); } if (!_defaultCookies?.Equals(site._defaultCookies) ?? site._defaultCookies != null) { return(false); } if (!Domain?.Equals(site.Domain) ?? site.Domain != null) { return(false); } if (!_headers?.Equals(site._headers) ?? site._headers != null) { return(false); } if (!_startRequests?.Equals(site._startRequests) ?? site._startRequests != null) { return(false); } if (!UserAgent?.Equals(site.UserAgent) ?? site.UserAgent != null) { return(false); } return(true); }
//public override bool equals(object obj) { public bool equals(object obj) { if (this == obj) { return(true); } if (obj == null) { return(false); } if (GetType() != obj.GetType()) { return(false); } ServerConfiguration other = (ServerConfiguration)obj; /*return new EqualsBuilder(). * Append(detectionPoints, other.getDetectionPoints()). * Append(correlationSets, other.getCorrelationSets()). * Append(clientApplicationIdentificationHeaderName, other.getClientApplicationIdentificationHeaderName()). * Append(clientApplications, other.getClientApplications()). * isEquals();*/ if (detectionPoints.Equals(other.getDetectionPoints()) && correlationSets.Equals(other.getCorrelationSets()) && clientApplicationIdentificationHeaderName.Equals(other.getClientApplicationIdentificationHeaderName()) && clientApplications.Equals(other.getClientApplications())) { return(true); } else { return(false); } }
public bool Osszefuggo(int kezdopont) { HashSet <int> bejart = new HashSet <int>(); Queue <int> kovetkezo = new Queue <int>(); kovetkezo.Enqueue(0); bejart.Add(0); while (kovetkezo.Count > 0) { kezdopont = kovetkezo.Dequeue(); } foreach (El el in this.elek) { if (el.Csucs1 == kezdopont && !bejart.Contains(el.Csucs2)) { kovetkezo.Enqueue(el.Csucs2); bejart.Add(el.Csucs2); } } if (bejart.Equals(this.csucsokSzama)) { Console.WriteLine("Igen"); return(true); } else { Console.WriteLine("Nem"); return(false); } }
public bool Osszefuggo(int kezdopont) { HashSet <int> bejart = new HashSet <int>(); Queue <int> kovetkezok = new Queue <int>(); kovetkezok.Enqueue(0); bejart.Add(0); while (kovetkezok.Count > 0) { kezdopont = kovetkezok.Dequeue(); } foreach (var item in elek) { if (item.Csucs1 == kezdopont && !bejart.Contains(item.Csucs2)) { kovetkezok.Enqueue(item.Csucs2); bejart.Add(item.Csucs2); } } if (bejart.Equals(csucsokSzama)) { return(true); } else { return(false); } }
public bool Osszefuggo(int a) { HashSet <int> eddig = new HashSet <int>(); Queue <int> kovetkezo = new Queue <int>(); kovetkezo.Enqueue(0); eddig.Add(0); while (kovetkezo.Count > 0) { a = kovetkezo.Dequeue(); } foreach (var item in elek) { if (item.Csucs1 == a && !eddig.Contains(item.Csucs2)) { kovetkezo.Enqueue(item.Csucs2); eddig.Add(item.Csucs2); } } if (eddig.Equals(csucsokSzama)) { Console.WriteLine("igen"); return(true); } else { Console.WriteLine("nem"); return(false); } }
private static void ParseConfigFile() { string[] separatedEntries; string[] entries = File.ReadAllLines(Configurations.configFilePath); for (int i = 0; i < entries.Length; i++) { if (entries[i] == "") { continue; } if (!entries[i].Contains(':')) { continue; } separatedEntries = entries[i].Split(':'); HandleConfigField(separatedEntries[0], separatedEntries[1]); if (allArguments.Contains(separatedEntries[0])) { readArguments.Add(separatedEntries[0]); } } if (!readArguments.Equals(allArguments)) { FillInMissingConfig(); } readArguments.Clear(); }
public void Test_Equals() { hs = new HashSet<int> { 1, 2, 3, 4}; HashSet<int> hs1 = hs; Assert.That(hs, Is.SameAs(hs1)); Assert.That(hs.Equals(hs1), Is.True); }
public JoinNode( PlanNodeId id, JoinType type, PlanNode left, PlanNode right, IEnumerable <EquiJoinClause> criteria, IEnumerable <Symbol> outputSymbols, dynamic filter, Symbol leftHashSymbol, Symbol rightHashSymbol, DistributionType distributionType ) : base(id) { this.Type = type; this.Left = left ?? throw new ArgumentNullException("left"); this.Right = right ?? throw new ArgumentNullException("right"); this.Criteria = criteria ?? throw new ArgumentNullException("criteria"); this.OutputSymbols = outputSymbols ?? throw new ArgumentNullException("outputSymbols"); this.Filter = filter; this.LeftHashSymbol = leftHashSymbol; this.RightHashSymbol = rightHashSymbol; this.DistributionType = distributionType; HashSet <Symbol> InputSymbols = new HashSet <Symbol>(this.Left.GetOutputSymbols().Concat(this.Right.GetOutputSymbols())); ParameterCheck.Check(this.OutputSymbols.All(x => InputSymbols.Contains(x)), "Left and right join inputs do not contain all output symbols."); ParameterCheck.Check(!this.IsCrossJoin() || InputSymbols.Equals(this.OutputSymbols), "Cross join does not support output symbols pruning or reordering."); ParameterCheck.Check(!(!this.Criteria.Any() && this.LeftHashSymbol != null), "Left hash symbol is only valid in equijoin."); ParameterCheck.Check(!(!this.Criteria.Any() && this.RightHashSymbol != null), "Right hash symbol is only valid in equijoin."); }
static public bool EqualsListString(this string it, string src, char delimitSymbol) { HashSet <string> set1 = new HashSet <string>(it.Split(delimitSymbol)); HashSet <string> set2 = new HashSet <string>(src.Split(delimitSymbol)); return(set1.Equals(set2)); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null) { return(false); } if (GetType() != obj.GetType()) { return(false); } CorrelationSet other = (CorrelationSet)obj; /*return new EqualsBuilder(). * Append(clientApplications, other.getClientApplications()). * isEquals();*/ if (clientApplications.Equals(other.getClientApplications())) { return(true); } else { return(false); } }
public static void ArrangeMembers(int member1, int member2, ICollection <HashSet <int> > tribes) { var tribe1 = new HashSet <int>(); //плем'я яке містить 1-го мембера' var tribe2 = new HashSet <int>(); //плем'я яке містить 2-го мембера' // запам'ятовуємо плем'я foreach (var tribe in tribes) { if (tribe.Contains(member1)) { tribe1 = tribe; } } foreach (var tribe in tribes) { if (tribe.Contains(member2)) { tribe2 = tribe; } } //Both members still not arranged if (tribe1.Count == 0 && tribe2.Count == 0) { tribes.Add(new HashSet <int>(100) { member1, member2 }); return; } //Member1 not arranged if (tribe1.Count == 0) { tribe2.Add(member1); return; } //Member2 not arranged if (tribe2.Count == 0) { tribe1.Add(member2); return; } //Both members arranged but they are in different sequenses if (!tribe1.Equals(tribe2)) { tribe1.UnionWith(tribe2); tribes.Remove(tribe2); } }
public void Methods_Ignored() { var set = new HashSet <int>(); set.GetHashCode(); set.Equals(items); set.GetType(); set.Contains(5); }
public virtual void TestEquals() { NUnit.Framework.Assert.IsTrue(set.Equals(set)); HashSet <int> hset = new HashSet <int>(); Sharpen.Collections.AddAll(hset, set); NUnit.Framework.Assert.IsTrue(set.Equals(hset)); NUnit.Framework.Assert.IsTrue(hset.Equals(set)); }
public override bool Equals(object obj) { GameStatusModel item = obj as GameStatusModel; if (item == null) { return(false); } return(historySet.Equals(item.historySet) && playerSet.Equals(item.playerSet) && leftDomino.Equals(item.leftDomino) && rightDomino.Equals(item.rightDomino) && upperDomino.Equals(item.upperDomino) && lowerDomino.Equals(item.lowerDomino)); }
public override bool Equals(object value) { if (!(value is SourceValue)) { return(false); } var sourceValue = (SourceValue)value; return(size == sourceValue.size && insns.Equals(sourceValue.insns)); }
internal override void HandleConnectedSetChanged(NativeRealTimeRoom room) { HashSet <string> newConnectedSet = new HashSet <string>(); foreach (var participant in room.Participants()) { using (participant) { if (participant.IsConnectedToRoom()) { newConnectedSet.Add(participant.Id()); } } } // If the connected set hasn't actually changed, bail out. if (mConnectedParticipants.Equals(newConnectedSet)) { Logger.w("Received connected set callback with unchanged connected set!"); return; } var noLongerConnected = mConnectedParticipants.Except(newConnectedSet); // Check whether a participant that was in the connected set has left it. // If so, we will never reach a fully connected state, and should fail room // creation. if (noLongerConnected.Any()) { Logger.e("Participants disconnected during room setup, failing. " + "Participants were: " + string.Join(",", noLongerConnected.ToArray())); LeaveRoom(); return; } var newlyConnected = newConnectedSet.Except(mConnectedParticipants); Logger.d("New participants connected: " + string.Join(",", newlyConnected.ToArray())); // If we're fully connected, transition to the Active state and signal the client. if (newConnectedSet.Count() == room.ParticipantCount()) { Logger.d("Fully connected! Transitioning to active state."); mSession.EnterState(new ActiveState(room, mSession)); mSession.OnGameThreadListener().RoomConnected(true); return; } // Otherwise, we're not fully there. Increment the progress by the appropriate // amount and inform the client. mPercentComplete += mPercentPerParticipant * (float)newlyConnected.Count(); mConnectedParticipants = newConnectedSet; mSession.OnGameThreadListener().RoomSetupProgress(mPercentComplete); }
public bool DistinctSets(Coord c1, Coord c2) { HashSet <Coord> set1 = GetSet(c1); HashSet <Coord> set2 = GetSet(c2); if (set1.Equals(set2)) { return(false); } return(true); }
public IGuess NextGuess(HangmanGame game) { string pattern = game.GuessedSoFar; ISet <char> guessedLetters = game.AllGuessedLetters; ISet <char> guessed = new HashSet <char>(guessedLetters); ISet <string> wrongWords = game.IncorrectlyGuessedWords; //NOTE: The strategy will make a word guess either when there's only one //word in the wordset, or when there's only one blank left. //When a word guess failed, the incorrectly guessed letter in the word should be //counted. if (wrongWords.Count > 0) { int idx = pattern.IndexOf(HangmanGame.MYSTERY_LETTER); foreach (string wd in wrongWords) { guessed.Add(wd[idx]); } } //Update the wordset when the game status(pattern and guessed) doesn't match. if (!(pattern.Equals(this.wordset.pattern) && guessed.Equals(this.wordset.guessedLetters))) { //Update wordset on a previous guess result, be it successful or not. this.wordset = new WordSet(pattern, guessed, this.wordset); } if (this.wordset.Count == 1) { return(new GuessWord(this.wordset.First())); } int patternBlanks = NumOfBlanks(pattern); if (patternBlanks > 1) { if (game.NumWrongGuessesRemaining == 0) { //Simply return the first word in the word set for the last chance. return(new GuessWord(this.wordset.First())); } else { return(new GuessLetter((this.wordset.Suggest(guessedLetters)))); } } else { //When there's only one blank letter, try to guess the word to save one //score on a successfull guess. char ch = this.wordset.Suggest(guessed); return(new GuessWord(pattern.Replace(HangmanGame.MYSTERY_LETTER, ch))); } }
public static void AssertEqual <T>(HashSet <T> expected, object actual) { if (expected.Equals(actual)) { return; } var expectedvalues = new List <T>(expected); var actualvalues = ((IEnumerable)actual).Cast <T>().ToList(); Assert.Equal(expectedvalues, actualvalues); // hashsets must be equal }
private HashSet <IModInputCombination> GetCombinationsFromKeyboard() { var countdownTrigger = false; var nullableHash = GetHashFromKeyboard(); if (nullableHash == null) { return(new HashSet <IModInputCombination>()); } var hash = (long)nullableHash; if (hash < 0) { countdownTrigger = true; hash = -hash; } if (!_comboRegistry.ContainsKey(hash)) { return(new HashSet <IModInputCombination>()); } var combinations = new HashSet <IModInputCombination>(_comboRegistry[hash]); if (!_currentCombinations.Equals(combinations) && countdownTrigger) { combinations.IntersectWith(_currentCombinations); } if (combinations.Count == 0) { return(combinations); } while (hash > 0) { _timeout[hash % ModInputLibrary.MaxUsefulKey] = Time.realtimeSinceStartup; hash /= ModInputLibrary.MaxUsefulKey; } return(combinations); }
internal override void HandleConnectedSetChanged(NativeRealTimeRoom room) { HashSet <string> hashSet = new HashSet <string>(); if ((room.Status() == Types.RealTimeRoomStatus.AUTO_MATCHING || room.Status() == Types.RealTimeRoomStatus.CONNECTING) && mSession.MinPlayersToStart <= room.ParticipantCount()) { mSession.MinPlayersToStart += room.ParticipantCount(); mPercentPerParticipant = 80f / (float)(double)mSession.MinPlayersToStart; } foreach (GooglePlayGames.Native.PInvoke.MultiplayerParticipant item in room.Participants()) { using (item) { if (item.IsConnectedToRoom()) { hashSet.Add(item.Id()); } } } if (mConnectedParticipants.Equals(hashSet)) { Logger.w("Received connected set callback with unchanged connected set!"); } else { IEnumerable <string> source = mConnectedParticipants.Except(hashSet); if (room.Status() == Types.RealTimeRoomStatus.DELETED) { Logger.e("Participants disconnected during room setup, failing. Participants were: " + string.Join(",", source.ToArray())); mSession.OnGameThreadListener().RoomConnected(false); mSession.EnterState(new ShutdownState(mSession)); } else { IEnumerable <string> source2 = hashSet.Except(mConnectedParticipants); Logger.d("New participants connected: " + string.Join(",", source2.ToArray())); if (room.Status() == Types.RealTimeRoomStatus.ACTIVE) { Logger.d("Fully connected! Transitioning to active state."); mSession.EnterState(new ActiveState(room, mSession)); mSession.OnGameThreadListener().RoomConnected(true); } else { mPercentComplete += mPercentPerParticipant * (float)source2.Count(); mConnectedParticipants = hashSet; mSession.OnGameThreadListener().RoomSetupProgress(mPercentComplete); } } } }
public bool Equals(HackyHashSet <T> other) { if (Object.ReferenceEquals(other, null)) { return(false); } if (Object.ReferenceEquals(this, other)) { return(true); } return(set.Equals(other.set)); }
public override bool Equals(Object obj) { if (this == obj) { return(true); } if ((obj == null) || !(obj is TermsFilter)) { return(false); } TermsFilter test = (TermsFilter)obj; return(terms == test.terms || (terms != null && terms.Equals(test.terms))); }
public void ShouldReturnDifferentRentalSetFromConstruction() { var rentals = new HashSet <Rental> { RENTAL_ONE }; var transaction = new Transaction(new DateTime(), CUSTOMER_ONE, rentals); rentals.Add(RENTAL_TWO); Assert.IsFalse(rentals.Equals(transaction.Rentals)); Assert.That(transaction.Rentals, Is.EquivalentTo(new HashSet <Rental> { RENTAL_ONE })); }
public static void AssertEqual <T>(HashSet <T> expected, object actual) { if (expected.Equals(actual)) { return; } List <T> expectedvalues = new List <T>(expected); List <T> actualvalues = new List <T>(); foreach (object x in (IEnumerable)actual) { actualvalues.Add((T)x); } Assert.Equal(expectedvalues, actualvalues); // hashsets must be equal }
public void ValueEquals_DiffOrderInt32HashSet_ReturnsFalse() { var o1 = new HashSet <int>() { 1, 2, 3 }; var o2 = new HashSet <int>() { 2, 3, 1 }; Assert.IsFalse(o1.Equals(o2)); Assert.IsTrue(o1.SetEquals(o2)); Assert.IsFalse(o1.SequenceEqual(o2)); Assert.IsFalse(o1.ValueEquals(o2)); }
private void handleConnectedSetChanged(AndroidJavaObject room) { HashSet <string> oldConnectedSet = new HashSet <string>(); foreach (Participant participant in mParent.GetConnectedParticipants()) { oldConnectedSet.Add(participant.ParticipantId); } mParent.mRoom = room; HashSet <string> connectedSet = new HashSet <string>(); foreach (Participant participant in mParent.GetConnectedParticipants()) { connectedSet.Add(participant.ParticipantId); } // If the connected set hasn't actually changed, bail out. if (oldConnectedSet.Equals(connectedSet)) { OurUtils.Logger.w("Received connected set callback with unchanged connected set!"); return; } List <string> noLongerConnected = new List <string>(); foreach (string id in oldConnectedSet) { if (!connectedSet.Contains(id)) { noLongerConnected.Add(id); } } if (mParent.GetRoomStatus() == RoomStatus.Deleted) { OurUtils.Logger.e("Participants disconnected during room setup, failing. " + "Participants were: " + string.Join(",", noLongerConnected.ToArray())); mParent.mListener.OnRoomConnected(false); mParent.CleanSession(); return; } mParent.mListener.OnRoomSetupProgress(mParent.GetPercentComplete()); }
private bool allPathsAreReachableRecursive(Coord c, HashSet <Coord> visitedPaths, HashSet <Coord> allPaths, bool[,] visited) { if (c == null) { return(false); } int x = c.x; int y = c.y; try { Square s = maze[x, y]; } catch (IndexOutOfRangeException) { return(false); } if (visited[x, y] == true) { return(false); } else if (maze[x, y] == Square.WALL) { return(false); } else if (maze[x, y] == Square.PATH || maze[x, y] == Square.ENTRANCE || maze[x, y] == Square.EXIT) { visited[x, y] = true; visitedPaths.Add(new Coord(x, y)); } //forward allPathsAreReachableRecursive(new Coord(x + 1, y), visitedPaths, allPaths, visited); //right allPathsAreReachableRecursive(new Coord(x, y + 1), visitedPaths, allPaths, visited); //backward allPathsAreReachableRecursive(new Coord(x - 1, y), visitedPaths, allPaths, visited); //left allPathsAreReachableRecursive(new Coord(x, y - 1), visitedPaths, allPaths, visited); return(visitedPaths.Equals(allPaths)); }
public override bool Equals(object obj) { if (obj is Filter other) { if (other.Mode != Mode) { return(false); } if (Data.Equals(other.Data)) { return(true); } return(Data.SetEquals(other.Data)); } return(false); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (!GetType().Equals(obj.GetType())) { return(false); } RegionQuadtree <T> otherQuadtree = (RegionQuadtree <T>)obj; return(points.Equals(otherQuadtree.points) && data.Equals(otherQuadtree.data) && depth == otherQuadtree.depth && region.Equals(otherQuadtree.region)); }
public void GetNonEmptyCellsWithRandomCellsAdded() { HashSet <string> refrence = new HashSet <string>(); string[] letter = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; Spreadsheet s = new Spreadsheet(); for (int i = 1; i < 1000; i++) { string cell = letter[i % 26] + letter[(i * 100) % 26] + i; s.SetContentsOfCell(cell, cell); refrence.Add(cell); } HashSet <string> sheetNames = new HashSet <string>(s.GetNamesOfAllNonemptyCells()); Assert.IsTrue(refrence.Equals(refrence)); }
// // public LinkedHashMap<String, String> orderKey(HashMap<String, String> key) { // LinkedHashMap<String, String> orderedKey = new LinkedHashMap<String, String>(); // for (IDimensionObjectBase d : dimensions){ // if (key.containsKey(d.getConcept().getId())){ // orderedKey.put(d.getConcept().getId(), key.get(d.getConcept().getId())); // } // } // return orderedKey; // } public virtual String GetGroupId(ISet<String> dimensions0) { /* foreach */ foreach (IGroupObjectBase g in _groups) { ISet<String> grpDims = new HashSet<String>(); /* foreach */ foreach (IDimensionObjectBase d in g.Dimension) { grpDims.Add(d.Id); } if (grpDims.Equals(dimensions0)) { return g.Id; } } return null; }