X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Frequest%2FVariableRead.java;h=04aa46092e3407a959da6c2aecfa51f9f90c59ed;hb=31a36bcdcd31bedc2e5106dba68ae057ba9c1875;hp=fc8641b9990b402eb2a4f3c223185e8986361807;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/VariableRead.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/VariableRead.java index fc8641b99..04aa46092 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/VariableRead.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/VariableRead.java @@ -1,97 +1,97 @@ -/******************************************************************************* - * 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.db.layer0.request; - -import org.simantics.db.AsyncRequestProcessor; -import org.simantics.db.RequestProcessor; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.variable.Variable; -import org.simantics.db.procedure.AsyncListener; -import org.simantics.db.procedure.AsyncProcedure; -import org.simantics.db.procedure.Listener; -import org.simantics.db.procedure.Procedure; -import org.simantics.db.procedure.SyncListener; -import org.simantics.db.procedure.SyncProcedure; -import org.simantics.db.request.Read; -import org.simantics.db.request.ReadInterface; - -public abstract class VariableRead implements Read, ReadInterface { - - final protected Variable variable; - - @Override - public int hashCode() { - return variable.hashCode(); - } - - protected Class clazz() { - return getClass(); - } - - @Override - public boolean equals(Object object) { - if (this == object) - return true; - else if (object == null) - return false; - else if (!clazz().isInstance(object)) - return false; - VariableRead r = (VariableRead) object; - return variable.equals(r.variable); - } - - public VariableRead(Variable variable) { - if(variable == null) throw new IllegalArgumentException("Null variable."); - this.variable = variable; - } - - @Override - public void request(AsyncRequestProcessor processor, AsyncProcedure procedure) { - processor.asyncRequest(this, procedure); - } - - @Override - public void request(AsyncRequestProcessor processor, Procedure procedure) { - processor.asyncRequest(this, procedure); - } - - @Override - public void request(AsyncRequestProcessor processor, SyncProcedure procedure) { - processor.asyncRequest(this, procedure); - } - - @Override - public void request(AsyncRequestProcessor processor, AsyncListener procedure) { - processor.asyncRequest(this, procedure); - } - - @Override - public void request(AsyncRequestProcessor processor, Listener procedure) { - processor.asyncRequest(this, procedure); - } - - @Override - public void request(AsyncRequestProcessor processor, SyncListener procedure) { - processor.asyncRequest(this, procedure); - } - - @Override - public T request(RequestProcessor processor) throws DatabaseException { - return processor.syncRequest(this); - } - - @Override - public String toString() { - return getClass().getSimpleName() + "|" + variable; - } - -} +/******************************************************************************* + * 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.db.layer0.request; + +import org.simantics.db.AsyncRequestProcessor; +import org.simantics.db.RequestProcessor; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.variable.Variable; +import org.simantics.db.procedure.AsyncListener; +import org.simantics.db.procedure.AsyncProcedure; +import org.simantics.db.procedure.Listener; +import org.simantics.db.procedure.Procedure; +import org.simantics.db.procedure.SyncListener; +import org.simantics.db.procedure.SyncProcedure; +import org.simantics.db.request.Read; +import org.simantics.db.request.ReadInterface; + +public abstract class VariableRead implements Read, ReadInterface { + + final protected Variable variable; + + @Override + public int hashCode() { + return variable.hashCode(); + } + + protected Class clazz() { + return getClass(); + } + + @Override + public boolean equals(Object object) { + if (this == object) + return true; + else if (object == null) + return false; + else if (!clazz().isInstance(object)) + return false; + VariableRead r = (VariableRead) object; + return variable.equals(r.variable); + } + + public VariableRead(Variable variable) { + if(variable == null) throw new IllegalArgumentException("Null variable."); + this.variable = variable; + } + + @Override + public void request(AsyncRequestProcessor processor, AsyncProcedure procedure) { + processor.asyncRequest(this, procedure); + } + + @Override + public void request(AsyncRequestProcessor processor, Procedure procedure) { + processor.asyncRequest(this, procedure); + } + + @Override + public void request(AsyncRequestProcessor processor, SyncProcedure procedure) { + processor.asyncRequest(this, procedure); + } + + @Override + public void request(AsyncRequestProcessor processor, AsyncListener procedure) { + processor.asyncRequest(this, procedure); + } + + @Override + public void request(AsyncRequestProcessor processor, Listener procedure) { + processor.asyncRequest(this, procedure); + } + + @Override + public void request(AsyncRequestProcessor processor, SyncListener procedure) { + processor.asyncRequest(this, procedure); + } + + @Override + public T request(RequestProcessor processor) throws DatabaseException { + return processor.syncRequest(this); + } + + @Override + public String toString() { + return getClass().getSimpleName() + "|" + variable; + } + +}