Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GetHashCode() & Equals() position implementation

  • Version: All
  • Product: WRobot General
  • Type: Suggestion
  • Status: Added

The following classes can have these overrides implemented:

Vector3
TaxiNode

A correct implementation would look like this:

        public override int GetHashCode()
        {
            return (Position.X.GetHashCode() * 397 ^ Position.Y.GetHashCode()) * 397 ^ Position.Z.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            Node rhs = obj as Node;
            if (rhs == null)
                return false;
            return Position.X == rhs.Position.X
                && Position.Y == rhs.Position.Y
                && Position.Z == rhs.Position.Z;
        }

This will enable the usage of the class in Dictionary<> and HashSet<>.

These collections provide higher performance and uniqueness of each inserted element.

List<> collection's behavior will stay the same.

User Feedback

Recommended Comments

Hello, thank you,

I added it, wait next update:

        public override int GetHashCode()
        {
            try
            {
                return (X.GetHashCode() * 397 ^ Y.GetHashCode()) * 397 ^ Z.GetHashCode();
            }
            catch
            { }
            return 0;
        }

        public override bool Equals(object obj)
        {
            try
            {
                var v = obj as Vector3;
                if (v == null)
                    return false;
                return X == v.X
                       && Y == v.Y
                       && Z == v.Z;
            }
            catch
            { }
            return false;
        }

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.