Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an isEqual Method #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Adding an isEqual Method #20

wants to merge 2 commits into from

Conversation

Jud
Copy link

@Jud Jud commented Jul 16, 2014

When TKStateMachine tries to determine if it can fire an event, it does:

[tkEventInstance.states containsObject: self.currentState];

If you haven't instantiated the current state with the exact TKState instance used when setting up the machine, this will always fail to fire events.

This fixes that issue.

When `TKStateMachine` tries to determine if it can fire an event, it does:

```
[tkEventInstance.states containsObject: self.currentState];
```
If you haven't instantiated the current state with the exact `TKState` instance used when setting up the machine, this will always fail to fire events.

This fixes that issue.
if (!other || ![other isKindOfClass:[self class]]) {
return NO;
}
if ([self name] != [other name]) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this be a string comparison?

@Jud
Copy link
Author

Jud commented Jul 17, 2014

@blakewatters Fixed that comparison. Wasn't really using my brain on that one.

@@ -74,4 +74,20 @@ - (void)encodeWithCoder:(NSCoder *)aCoder
[aCoder encodeObject:self.name forKey:@"name"];
}

# pragma mark - isEqual
- (BOOL)isEqual:(id)other
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When defining the isEqual: method, ou MUST also implement the hash method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants