| 950 | } |
| 951 | |
| 952 | func (lhs *regExpSet) Append(arg DefinedSet) error { |
| 953 | if lhs.Type() != arg.Type() { |
| 954 | return fmt.Errorf("can't append to different type of defined-set") |
| 955 | } |
| 956 | var list []*regexp.Regexp |
| 957 | switch lhs.Type() { |
| 958 | case DEFINED_TYPE_AS_PATH: |
| 959 | list = arg.(*AsPathSet).list |
| 960 | case DEFINED_TYPE_COMMUNITY: |
| 961 | list = arg.(*CommunitySet).list |
| 962 | case DEFINED_TYPE_EXT_COMMUNITY: |
| 963 | list = arg.(*ExtCommunitySet).list |
| 964 | case DEFINED_TYPE_LARGE_COMMUNITY: |
| 965 | list = arg.(*LargeCommunitySet).list |
| 966 | default: |
| 967 | return fmt.Errorf("invalid defined-set type: %d", lhs.Type()) |
| 968 | } |
| 969 | lhs.list = append(lhs.list, list...) |
| 970 | return nil |
| 971 | } |
| 972 | |
| 973 | func (lhs *regExpSet) Remove(arg DefinedSet) error { |
| 974 | if lhs.Type() != arg.Type() { |