2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.equivalence;
11 import javax.annotation.Nullable;
13 import com.google.common.base.Equivalence;
14 import com.google.common.base.Function;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
19 * A simple fabric for equivalence rules and for functions used<br>
20 * in converting Lists to Sets with our own equivalence rules
22 public class EquivalenceFabric {
24 private EquivalenceFabric() {
25 throw new UnsupportedOperationException("Can not create an instance");
29 public static final FlowEquivalence FLOW_EQUIVALENCE = new FlowEquivalence();
30 public static final MatchEquivalence MATCH_EQUIVALENCE = new MatchEquivalence();
32 public static final Function<Flow, Equivalence.Wrapper<Flow>> FLOW_WRAPPER_FUNCTION =
33 new Function<Flow, Equivalence.Wrapper<Flow>>() {
37 public Equivalence.Wrapper<Flow> apply(@Nullable Flow input) {
38 return FLOW_EQUIVALENCE.wrap(input);
43 public static final BucketsEquivalence BUCKETS_EQUIVALENCE = new BucketsEquivalence();
44 public static final GroupEquivalence GROUP_EQUIVALENCE = new GroupEquivalence();
46 public static final Function<Group, Equivalence.Wrapper<Group>> GROUP_WRAPPER_FUNCTION =
47 new Function<Group, Equivalence.Wrapper<Group>>() {
51 public Equivalence.Wrapper<Group> apply(@Nullable Group input) {
52 return GROUP_EQUIVALENCE.wrap(input);