/*
 * Copyright 2016-present Open Networking Laboratory
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.onosproject.store.resource.impl;

import org.onosproject.net.resource.DiscreteResource;
import org.onosproject.net.resource.DiscreteResourceId;

import java.util.List;
import java.util.Optional;
import java.util.Set;

interface DiscreteResources {
    static DiscreteResources empty() {
        return NonEncodableDiscreteResources.empty();
    }

    Optional<DiscreteResource> lookup(DiscreteResourceId id);

    DiscreteResources difference(DiscreteResources other);

    boolean isEmpty();

    boolean containsAny(List<DiscreteResource> other);

    // returns a new instance, not mutate the current instance
    DiscreteResources add(DiscreteResources other);

    // returns a new instance, not mutate the current instance
    DiscreteResources remove(List<DiscreteResource> removed);

    Set<DiscreteResource> values();
}

@@ -845,582 +845,2009 @@
 t;%0A%0A
-interface DiscreteResources %7B%0A    static DiscreteResources empty() %7B%0A        return NonEncodableDiscreteResources.empty();%0A    %7D%0A%0A    Optional%3CDiscreteResource%3E lookup(DiscreteResourceId id);%0A%0A    DiscreteResources difference(DiscreteResources other);%0A%0A    boolean isEmpty();%0A%0A    boolean containsAny(List%3CDiscreteResource%3E other);%0A%0A    // returns a new instance, not mutate the current instance%0A    DiscreteResources add(DiscreteResources other);%0A%0A    // returns a new instance, not mutate the current instance%0A    DiscreteResources remove(List%3CDiscreteResource%3E removed);%0A
+/**%0A * A common API for a set of discrete resources.%0A */%0Ainterface DiscreteResources %7B%0A    /**%0A     * Returns an instance representing an empty set.%0A     *%0A     * @return a empty set.%0A     */%0A    static DiscreteResources empty() %7B%0A        return NonEncodableDiscreteResources.empty();%0A    %7D%0A%0A    /**%0A     * Look up a discrete resource instance by ID.%0A     *%0A     * @param id id%0A     * @return found instance enclosed by Optional%0A     */%0A    Optional%3CDiscreteResource%3E lookup(DiscreteResourceId id);%0A%0A    /**%0A     * Returns a difference set of this instance and the given instance.%0A     *%0A     * @param other other instance%0A     * @return a new DiscreteResources instance representing a difference set%0A     */%0A    DiscreteResources difference(DiscreteResources other);%0A%0A    /**%0A     * Checks that this instance is empty.%0A     *%0A     * @return true if this instance is empty, otherwise false.%0A     */%0A    boolean isEmpty();%0A%0A    /**%0A     * Checks that this instance contains any of the given resources.%0A     *%0A     * @param other resources%0A     * @return true this instance contains a resource included in the given resources,%0A     * otherwise false.%0A     */%0A    boolean containsAny(List%3CDiscreteResource%3E other);%0A%0A    /**%0A     * Returns a union set of this instance and the given instance.%0A     * Note: This method returns a new instance, not mutate the current instance%0A     *%0A     * @param other other instance%0A     * @return a new DiscreteResources instance representing a union set%0A     */%0A    DiscreteResources add(DiscreteResources other);%0A%0A    /**%0A     * Returns a difference set of this instance and the given resources.%0A     * Note: This method returns a new instance, not mutate the current intance.%0A     *%0A     * @param removed resources%0A     * @return a new DiscreteResources instance representing a difference set%0A     */%0A    DiscreteResources remove(List%3CDiscreteResource%3E removed);%0A%0A    /**%0A     * Returns all of resources this instance holds.%0A     *%0A     * @return all resources%0A     */
 %0A   

Write Javadoc for DiscreteResources