X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fadapter%2FBaseRequest2.java;h=94a184737353d1987b2d489bc37a4fda199a9a09;hb=617b9475710b80a125597f222f9777224972ce72;hp=69d1c1241497b63b430b1692ea7bc68cd63a1c41;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/BaseRequest2.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/BaseRequest2.java index 69d1c1241..94a184737 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/BaseRequest2.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/BaseRequest2.java @@ -1,65 +1,65 @@ -/******************************************************************************* - * 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.diagram.adapter; - -import org.simantics.db.request.AsyncRead; -import org.simantics.g2d.canvas.ICanvasContext; - -public abstract class BaseRequest2 implements AsyncRead { - - final protected T data; - - final int hash; - - final ICanvasContext canvas; - - //String debug; - - public BaseRequest2(ICanvasContext canvas, T data) { - this.canvas = canvas; - assert canvas != null; - assert data != null; - this.data = data; - this.hash = data.hashCode() + 31 * canvas.hashCode(); - } - - @Override - public int hashCode() { - return hash; - } - - public int threadHash() { - return hash; - } - - @Override - public boolean equals(Object other) { - if (this == other) - return true; - if (other == null || getClass() != other.getClass()) - return false; - BaseRequest2 o = (BaseRequest2) other; - return data.equals(o.data) && canvas.equals(o.canvas); - } - - @Override - public int getFlags() { - return 0; - } - - @Override - public String toString() { - return getClass().getSimpleName() + "[" + data + " - " + canvas.hashCode() + /*" " + debug +*/ "]"; - } - -} - +/******************************************************************************* + * 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.diagram.adapter; + +import org.simantics.db.request.AsyncRead; +import org.simantics.g2d.canvas.ICanvasContext; + +public abstract class BaseRequest2 implements AsyncRead { + + final protected T data; + + final int hash; + + final ICanvasContext canvas; + + //String debug; + + public BaseRequest2(ICanvasContext canvas, T data) { + this.canvas = canvas; + assert canvas != null; + assert data != null; + this.data = data; + this.hash = data.hashCode() + 31 * canvas.hashCode(); + } + + @Override + public int hashCode() { + return hash; + } + + public int threadHash() { + return hash; + } + + @Override + public boolean equals(Object other) { + if (this == other) + return true; + if (other == null || getClass() != other.getClass()) + return false; + BaseRequest2 o = (BaseRequest2) other; + return data.equals(o.data) && canvas.equals(o.canvas); + } + + @Override + public int getFlags() { + return 0; + } + + @Override + public String toString() { + return getClass().getSimpleName() + "[" + data + " - " + canvas.hashCode() + /*" " + debug +*/ "]"; + } + +} +