Empties the relation set
()
| 137 | * Empties the relation set |
| 138 | */ |
| 139 | @Override |
| 140 | public void clear() { |
| 141 | |
| 142 | // clearing the indexes won't fire the events so we fire the events |
| 143 | // first and then clear the indexes, hopefully we won't end up with |
| 144 | // any weird side effects from this but I can't think of a |
| 145 | // safer/better way of doing it other than calling delete on each |
| 146 | // relation which would be horribly inefficient |
| 147 | for(Relation r : indexById.values()) { |
| 148 | fireRelationRemoved(new RelationSetEvent(this, |
| 149 | RelationSetEvent.RELATION_REMOVED, r)); |
| 150 | } |
| 151 | |
| 152 | indexByType.clear(); |
| 153 | indexesByMember.clear(); |
| 154 | indexById.clear(); |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * The number of relations in this set. |
no test coverage detected