mirror of
https://gitlab.com/mysocialportal/relatica
synced 2024-10-18 19:23:31 +00:00
39 lines
824 B
Dart
39 lines
824 B
Dart
|
import 'timeline_entry.dart';
|
||
|
|
||
|
class EntryTreeItem {
|
||
|
final TimelineEntry entry;
|
||
|
final bool isMine;
|
||
|
bool isOrphaned;
|
||
|
|
||
|
final _children = <String, EntryTreeItem>{};
|
||
|
|
||
|
EntryTreeItem(this.entry, {this.isMine = true, this.isOrphaned = false});
|
||
|
|
||
|
String get id => entry.id;
|
||
|
|
||
|
void addChild(EntryTreeItem child) {
|
||
|
_children[child.id] = child;
|
||
|
}
|
||
|
|
||
|
int get totalChildren {
|
||
|
int t = _children.length;
|
||
|
for (final c in _children.values) {
|
||
|
t += c.totalChildren;
|
||
|
}
|
||
|
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
List<EntryTreeItem> get children => List.unmodifiable(_children.values);
|
||
|
|
||
|
@override
|
||
|
bool operator ==(Object other) =>
|
||
|
identical(this, other) ||
|
||
|
other is EntryTreeItem &&
|
||
|
runtimeType == other.runtimeType &&
|
||
|
entry == other.entry;
|
||
|
|
||
|
@override
|
||
|
int get hashCode => entry.hashCode;
|
||
|
}
|