001/**
002 * Java Web Archive Toolkit - Software to read and validate ARC, WARC
003 * and GZip files. (http://jwat.org/)
004 * Copyright 2011-2012 Netarkivet.dk (http://netarkivet.dk/)
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.jwat.warc;
019
020import org.jwat.common.Uri;
021
022/**
023 * Simple wrapper for a (non) validated WARC ConcurrentTo header.
024 *
025 * @author nicl
026 */
027public class WarcConcurrentTo {
028
029    /** Warc-Concurrent-To string representation. */
030    public String warcConcurrentToStr;
031
032    /** Warc-Concurrent-To <code>Uri</code> object. */
033    public Uri warcConcurrentToUri;
034
035    @Override
036    public boolean equals(Object obj) {
037        if (obj == null || !(obj instanceof WarcConcurrentTo)) {
038            return false;
039        }
040        WarcConcurrentTo concurrentToObj = (WarcConcurrentTo)obj;
041        if (warcConcurrentToStr != null) {
042            if (!warcConcurrentToStr.equals(concurrentToObj.warcConcurrentToStr)) {
043                return false;
044            }
045        } else if (concurrentToObj.warcConcurrentToStr != null) {
046            return false;
047        }
048        if (warcConcurrentToUri != null) {
049            if (!warcConcurrentToUri.equals(concurrentToObj.warcConcurrentToUri)) {
050                return false;
051            }
052        } else if (concurrentToObj.warcConcurrentToUri != null) {
053            return false;
054        }
055        return true;
056    }
057
058    @Override
059    public int hashCode() {
060        int hashCode = 0;
061        if (warcConcurrentToStr != null) {
062            hashCode ^= warcConcurrentToStr.hashCode();
063        }
064        if (warcConcurrentToUri != null) {
065            hashCode ^= warcConcurrentToUri.hashCode();
066        }
067        return hashCode;
068    }
069
070}