001/*
002 * Copyright (C) 2009-2011 Mathias Doenitz
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.parboiled.common;
018
019public final class Tuple3<A, B, C> {
020    public final A a;
021    public final B b;
022    public final C c;
023
024    public Tuple3(A a, B b, C c) {
025        this.a = a;
026        this.b = b;
027        this.c = c;
028    }
029
030    @Override
031    public boolean equals(Object o) {
032        if (this == o) return true;
033        if (!(o instanceof Tuple3)) return false;
034        Tuple3 tuple2 = (Tuple3) o;
035        return
036                (a != null ? a.equals(tuple2.a) : tuple2.a == null) &&
037                (b != null ? b.equals(tuple2.b) : tuple2.b == null) &&
038                (c != null ? c.equals(tuple2.c) : tuple2.c == null);
039    }
040
041    @Override
042    public int hashCode() {
043        int result = a != null ? a.hashCode() : 0;
044        result = 31 * result + (b != null ? b.hashCode() : 0);
045        result = 31 * result + (c != null ? c.hashCode() : 0);
046        return result;
047    }
048
049    @Override
050    public String toString() {
051        return "Tuple3{a=" + a + ", b=" + b + ", c=" + c + '}';
052    }
053}