(arg DefinedSet)
| 1792 | } |
| 1793 | |
| 1794 | func (s *ExtCommunitySet) Remove(arg DefinedSet) error { |
| 1795 | if s.Type() != arg.Type() { |
| 1796 | return fmt.Errorf("can't remove from different type of defined-set") |
| 1797 | } |
| 1798 | other := arg.(*ExtCommunitySet) |
| 1799 | newList := make([]*regexp.Regexp, 0, len(s.list)) |
| 1800 | newSubtypes := make([]bgp.ExtendedCommunityAttrSubType, 0, len(s.subtypeList)) |
| 1801 | for i, x := range s.list { |
| 1802 | found := false |
| 1803 | for _, y := range other.list { |
| 1804 | if x.String() == y.String() { |
| 1805 | found = true |
| 1806 | break |
| 1807 | } |
| 1808 | } |
| 1809 | if !found { |
| 1810 | newList = append(newList, x) |
| 1811 | newSubtypes = append(newSubtypes, s.subtypeList[i]) |
| 1812 | } |
| 1813 | } |
| 1814 | s.list = newList |
| 1815 | s.subtypeList = newSubtypes |
| 1816 | s.rebuildExtMatchers() |
| 1817 | return nil |
| 1818 | } |
| 1819 | |
| 1820 | func (s *ExtCommunitySet) Replace(arg DefinedSet) error { |
| 1821 | other, ok := arg.(*ExtCommunitySet) |
nothing calls this directly
no test coverage detected