001/*
002 * Copyright 2014 Global Biodiversity Information Facility (GBIF)
003 * Licensed under the Apache License, Version 2.0 (the "License");
004 * you may not use this file except in compliance with the License.
005 * You may obtain a copy of the License at
006 * http://www.apache.org/licenses/LICENSE-2.0
007 * Unless required by applicable law or agreed to in writing, software
008 * distributed under the License is distributed on an "AS IS" BASIS,
009 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010 * See the License for the specific language governing permissions and
011 * limitations under the License.
012 */
013package org.gbif.api.model.occurrence.predicate;
014
015import java.util.Collection;
016
017import com.google.common.base.Objects;
018import org.codehaus.jackson.annotate.JsonCreator;
019import org.codehaus.jackson.annotate.JsonProperty;
020
021/**
022 * This predicate is "OR"-ing its subpredicates together.
023 */
024public class DisjunctionPredicate extends CompoundPredicate {
025
026  @JsonCreator
027  public DisjunctionPredicate(@JsonProperty("predicates") Collection<Predicate> predicates) {
028    super(predicates);
029  }
030
031  @Override
032  public boolean equals(Object obj) {
033    if (this == obj) {
034      return true;
035    }
036
037    if (!(obj instanceof DisjunctionPredicate)) {
038      return false;
039    }
040
041    CompoundPredicate that = (CompoundPredicate) obj;
042    return Objects.equal(this.getPredicates(), that.getPredicates());
043  }
044}