Home | History | Annotate | Download | only in ceres

Lines Matching refs:element

46 // that can serve as a key in a map or an element of a set.
48 // An element can only belong to one group at a time. A group may
55 // Add an element to a group. If a group with this id does not
57 // times for the same element. Group ids should be non-negative
60 // Return value indicates if adding the element was a success.
61 bool AddElementToGroup(const T element, const int group) {
66 typename map<T, int>::const_iterator it = element_to_group_.find(element);
69 // Element is already in the right group, nothing to do.
73 group_to_elements_[it->second].erase(element);
79 element_to_group_[element] = group;
80 group_to_elements_[group].insert(element);
89 // Remove the element, no matter what group it is in. Return value
90 // indicates if the element was actually removed.
91 bool Remove(const T element) {
92 const int current_group = GroupId(element);
97 group_to_elements_[current_group].erase(element);
104 element_to_group_.erase(element);
143 // Return the group id for the element. If the element is not a
145 int GroupId(const T element) const {
146 typename map<T, int>::const_iterator it = element_to_group_.find(element);
153 bool IsMember(const T element) const {
154 typename map<T, int>::const_iterator it = element_to_group_.find(element);