-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.browsing.ui.graph.impl;\r
-\r
-import org.simantics.browsing.ui.NodeContext;\r
-import org.simantics.db.request.Read;\r
-\r
-/**\r
- * A database query which identifies itself by two fields: an abstract\r
- * idenfitier and an INodeContext.\r
- * \r
- * @author Antti Villberg\r
- * \r
- * @param <T>\r
- */\r
-public abstract class ResourceQuery<T> implements Read<T> {\r
-\r
- protected final Object queryIdentifier;\r
- protected final NodeContext context;\r
- protected int hash;\r
-\r
- public ResourceQuery(Object queryIdentifier, NodeContext context) {\r
- assert queryIdentifier != null;\r
- assert context != null;\r
- this.queryIdentifier = queryIdentifier;\r
- this.context = context;\r
- this.hash = makeHash();\r
- }\r
-\r
- @Override\r
- public boolean equals(Object object) {\r
-\r
- if (this == object)\r
- return true;\r
- else if (object == null)\r
- return false;\r
- else if (!(object instanceof ResourceQuery<?>))\r
- return false;\r
-\r
- ResourceQuery<?> query = (ResourceQuery<?>) object;\r
- return getClass() == query.getClass() && queryIdentifier.equals(query.queryIdentifier) && context.equals(query.context);\r
-\r
- }\r
-\r
- protected int makeHash() {\r
- return getClass().hashCode() * 31 + context.hashCode() * 41 + queryIdentifier.hashCode();\r
- }\r
-\r
- @Override\r
- final public int hashCode() {\r
- return hash;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.browsing.ui.graph.impl;
+
+import org.simantics.browsing.ui.NodeContext;
+import org.simantics.db.request.Read;
+
+/**
+ * A database query which identifies itself by two fields: an abstract
+ * idenfitier and an INodeContext.
+ *
+ * @author Antti Villberg
+ *
+ * @param <T>
+ */
+public abstract class ResourceQuery<T> implements Read<T> {
+
+ protected final Object queryIdentifier;
+ protected final NodeContext context;
+ protected int hash;
+
+ public ResourceQuery(Object queryIdentifier, NodeContext context) {
+ assert queryIdentifier != null;
+ assert context != null;
+ this.queryIdentifier = queryIdentifier;
+ this.context = context;
+ this.hash = makeHash();
+ }
+
+ @Override
+ public boolean equals(Object object) {
+
+ if (this == object)
+ return true;
+ else if (object == null)
+ return false;
+ else if (!(object instanceof ResourceQuery<?>))
+ return false;
+
+ ResourceQuery<?> query = (ResourceQuery<?>) object;
+ return getClass() == query.getClass() && queryIdentifier.equals(query.queryIdentifier) && context.equals(query.context);
+
+ }
+
+ protected int makeHash() {
+ return getClass().hashCode() * 31 + context.hashCode() * 41 + queryIdentifier.hashCode();
+ }
+
+ @Override
+ final public int hashCode() {
+ return hash;
+ }
+
+}