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.browsing.ui.graph.impl.request;
14 import java.util.Arrays;
16 import org.simantics.browsing.ui.NodeContext;
19 * @author Tuukka Lehtonen
23 public abstract class ParametrizedResourceQuery<T> extends ResourceQuery<T> {
27 public ParametrizedResourceQuery(Object queryIdentifier, NodeContext context, Object... parameters) {
28 super(queryIdentifier, context);
29 this.parameters = parameters;
30 this.hash = makeHash();
34 public boolean equals(Object object) {
38 else if (object == null)
40 else if (!(object instanceof ParametrizedResourceQuery<?>))
43 ParametrizedResourceQuery<?> query = (ParametrizedResourceQuery<?>) object;
44 return queryIdentifier.equals(query.queryIdentifier)
45 && context.equals(query.context)
46 && Arrays.equals(parameters, query.parameters);
50 protected int makeHash() {
51 return (context.hashCode() * 31 + queryIdentifier.hashCode()) * 31 + Arrays.hashCode(parameters);