1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.common.request;
16 abstract public class BinaryRead<P1, P2, R> extends GenericReadBase<P1, R> {
18 final protected P1 parameter;
19 final protected P2 parameter2;
24 public int hashCode() {
26 final int h1 = parameter != null ? parameter.hashCode() : 0;
27 final int h2 = parameter2 != null ? parameter2.hashCode() : 0;
28 hashCode = getClass().hashCode() + 31*(h1 + 31 * h2);
34 public boolean equals(Object object) {
37 else if (object == null)
39 else if (getClass() != object.getClass())
41 BinaryRead<?, ?, ?> r = (BinaryRead<?, ?, ?>) object;
43 if(hashCode() != r.hashCode()) return false;
45 if(parameter != null) {
46 if(!parameter.equals(r.parameter)) return false;
47 } else if(r.parameter != null) return false;
48 if(parameter2 != null) {
49 if(!parameter2.equals(r.parameter2)) return false;
50 } else if(r.parameter2 != null) return false;
55 public BinaryRead(P1 parameter1, P2 parameter2) {
56 this.parameter = parameter1;
57 this.parameter2 = parameter2;
61 public String toString() {
62 return getClass().getSimpleName() + "$" + parameter + "$" + parameter2;