c7e33efa223038a5c65540e61236d68c97922100
[groupbasedpolicy.git] / renderers / ofoverlay / src / main / java / org / opendaylight / groupbasedpolicy / renderer / ofoverlay / equivalence / EquivalenceFabric.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.equivalence;
10
11 import com.google.common.base.Equivalence;
12 import com.google.common.base.Function;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
14
15 import javax.annotation.Nullable;
16
17 /**
18  * A simple fabric for equivalence rules
19  * and for functions used in converting Lists to Sets with our own equivalence rules
20  *
21  */
22 public class EquivalenceFabric {
23
24     private EquivalenceFabric(){
25         throw new UnsupportedOperationException("Can not create an instance");
26     }
27
28     public static final FlowEquivalence FLOW_EQUIVALENCE = new FlowEquivalence();
29     public static final Function<Flow, Equivalence.Wrapper<Flow>> FLOW_WRAPPER_FUNCTION =
30             new Function<Flow, Equivalence.Wrapper<Flow>>() {
31                 @Nullable
32                 @Override
33                 public Equivalence.Wrapper<Flow> apply(@Nullable Flow input) {
34                     return FLOW_EQUIVALENCE.wrap(input);
35                 }
36             };
37
38     public static final MatchEquivalence MATCH_EQUIVALENCE = new MatchEquivalence();
39
40 }