Peter d153fe0f21 Add 'submodules/LegacyComponents/' from commit 'd5594346161c1b7f203d1e87068bbe77bcaac019'
git-subtree-dir: submodules/LegacyComponents
git-subtree-mainline: 608630530451e02e5aec48389d144dbf7a3625b9
git-subtree-split: d5594346161c1b7f203d1e87068bbe77bcaac019
2019-06-11 18:51:15 +01:00

33 lines
1.0 KiB
Objective-C

#import "TGMessageGroup.h"
@implementation TGMessageGroup
- (instancetype)initWithMinId:(int32_t)minId minTimestamp:(int32_t)minTimestamp maxId:(int32_t)maxId maxTimestamp:(int32_t)maxTimestamp count:(int32_t)count {
self = [super init];
if (self != nil) {
_minId = minId;
_minTimestamp = minTimestamp;
_maxId = maxId;
_maxTimestamp = maxTimestamp;
_count = count;
}
return self;
}
- (bool)isEqual:(id)object {
return [object isKindOfClass:[TGMessageGroup class]] && ((TGMessageGroup *)object)->_minId == _minId && ((TGMessageGroup *)object)->_maxId == _maxId && ((TGMessageGroup *)object)->_maxTimestamp == _maxTimestamp && ((TGMessageGroup *)object)->_count == _count;
}
- (NSString *)description {
return [[NSString alloc] initWithFormat:@"(%d...%d at %d)", _minId, _maxId, _maxTimestamp];
}
- (bool)intersects:(TGMessageGroup *)other {
if (other == nil)
return false;
return _minId <= other.maxId && _maxId >= other.minId;
}
@end