blob: acbec0ba9bcd036d78b68e9f81b9303b2ca2aca9 [file] [log] [blame]
Sho SHIMIZUb85000d2016-05-17 14:00:05 -07001/*
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 */
16package org.onosproject.store.resource.impl;
17
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070018import org.onosproject.net.resource.DiscreteResource;
19import org.onosproject.net.resource.DiscreteResourceId;
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070020
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070021import java.util.List;
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070022import java.util.Optional;
23import java.util.Set;
24
Sho SHIMIZU32f57e92016-05-18 10:23:06 -070025interface DiscreteResources {
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070026 static DiscreteResources empty() {
Sho SHIMIZU32f57e92016-05-18 10:23:06 -070027 return NonEncodableDiscreteResources.empty();
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070028 }
29
Sho SHIMIZU32f57e92016-05-18 10:23:06 -070030 Optional<DiscreteResource> lookup(DiscreteResourceId id);
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070031
Sho SHIMIZU32f57e92016-05-18 10:23:06 -070032 DiscreteResources difference(DiscreteResources other);
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070033
Sho SHIMIZU32f57e92016-05-18 10:23:06 -070034 boolean isEmpty();
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070035
Sho SHIMIZU32f57e92016-05-18 10:23:06 -070036 boolean containsAny(List<DiscreteResource> other);
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070037
38 // returns a new instance, not mutate the current instance
Sho SHIMIZU32f57e92016-05-18 10:23:06 -070039 DiscreteResources add(DiscreteResources other);
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070040
41 // returns a new instance, not mutate the current instance
Sho SHIMIZU32f57e92016-05-18 10:23:06 -070042 DiscreteResources remove(List<DiscreteResource> removed);
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070043
Sho SHIMIZU32f57e92016-05-18 10:23:06 -070044 Set<DiscreteResource> values();
Sho SHIMIZUb85000d2016-05-17 14:00:05 -070045}