X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.graph.impl%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fgraph%2Fimpl%2FResourceQuery.java;h=2b1a11b43f6cf13c9ebeed17920c811132b6c29d;hp=b76d16e5a3252bb0be2d56a5e66124af2fdba415;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/ResourceQuery.java b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/ResourceQuery.java index b76d16e5a..2b1a11b43 100644 --- a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/ResourceQuery.java +++ b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/ResourceQuery.java @@ -1,63 +1,63 @@ -/******************************************************************************* - * 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 - */ -public abstract class ResourceQuery implements Read { - - 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; - } - -} +/******************************************************************************* + * 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 + */ +public abstract class ResourceQuery implements Read { + + 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; + } + +}