Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.store.resource.impl; |
| 17 | |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 18 | import org.onosproject.net.resource.DiscreteResource; |
| 19 | import org.onosproject.net.resource.DiscreteResourceId; |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 20 | |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 21 | import java.util.List; |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 22 | import java.util.Optional; |
| 23 | import java.util.Set; |
| 24 | |
Sho SHIMIZU | 32f57e9 | 2016-05-18 10:23:06 -0700 | [diff] [blame^] | 25 | interface DiscreteResources { |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 26 | static DiscreteResources empty() { |
Sho SHIMIZU | 32f57e9 | 2016-05-18 10:23:06 -0700 | [diff] [blame^] | 27 | return NonEncodableDiscreteResources.empty(); |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 28 | } |
| 29 | |
Sho SHIMIZU | 32f57e9 | 2016-05-18 10:23:06 -0700 | [diff] [blame^] | 30 | Optional<DiscreteResource> lookup(DiscreteResourceId id); |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 31 | |
Sho SHIMIZU | 32f57e9 | 2016-05-18 10:23:06 -0700 | [diff] [blame^] | 32 | DiscreteResources difference(DiscreteResources other); |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 33 | |
Sho SHIMIZU | 32f57e9 | 2016-05-18 10:23:06 -0700 | [diff] [blame^] | 34 | boolean isEmpty(); |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 35 | |
Sho SHIMIZU | 32f57e9 | 2016-05-18 10:23:06 -0700 | [diff] [blame^] | 36 | boolean containsAny(List<DiscreteResource> other); |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 37 | |
| 38 | // returns a new instance, not mutate the current instance |
Sho SHIMIZU | 32f57e9 | 2016-05-18 10:23:06 -0700 | [diff] [blame^] | 39 | DiscreteResources add(DiscreteResources other); |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 40 | |
| 41 | // returns a new instance, not mutate the current instance |
Sho SHIMIZU | 32f57e9 | 2016-05-18 10:23:06 -0700 | [diff] [blame^] | 42 | DiscreteResources remove(List<DiscreteResource> removed); |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 43 | |
Sho SHIMIZU | 32f57e9 | 2016-05-18 10:23:06 -0700 | [diff] [blame^] | 44 | Set<DiscreteResource> values(); |
Sho SHIMIZU | b85000d | 2016-05-17 14:00:05 -0700 | [diff] [blame] | 45 | } |