X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.structural2%2Fsrc%2Forg%2Fsimantics%2Fstructural2%2Fvariables%2FAbstractVariableConnectionPointDescriptor.java;h=382c52e3fe0cf38e5f380ea16fc2bcf2dc5f7f6e;hb=e807368d0e75809e0797d9cea1063b046fabf352;hp=561567791ba82966ffebc7abfc667d6efb2ee2e5;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/AbstractVariableConnectionPointDescriptor.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/AbstractVariableConnectionPointDescriptor.java index 561567791..382c52e3f 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/AbstractVariableConnectionPointDescriptor.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/AbstractVariableConnectionPointDescriptor.java @@ -1,62 +1,62 @@ -package org.simantics.structural2.variables; - -import java.util.Collection; - -import org.simantics.db.ReadGraph; -import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; -import org.simantics.db.common.request.UnaryRead; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.request.PropertyInfo; -import org.simantics.db.layer0.request.PropertyInfoRequest; -import org.simantics.db.layer0.variable.Variable; -import org.simantics.db.layer0.variable.Variables; -import org.simantics.structural2.Functions; -import org.simantics.structural2.Functions.InterfaceResolution; - -abstract public class AbstractVariableConnectionPointDescriptor implements VariableConnectionPointDescriptor { - - static class ComputeInterfaceDescription extends UnaryRead> { - - public ComputeInterfaceDescription(AbstractVariableConnectionPointDescriptor desc) { - super(desc); - } - - @Override - public Collection perform(ReadGraph graph) throws DatabaseException { - return Functions.computeInterfacePaths(graph, parameter.getVariable(graph).getParent(graph)); - } - - } - - @Override - public Collection getInterfaceDescription(ReadGraph graph) throws DatabaseException { - return graph.syncRequest(new ComputeInterfaceDescription(this), TransientCacheAsyncListener.>instance()); - } - - @Override - public boolean isLeaf(ReadGraph graph) throws DatabaseException { - - Collection inf = getInterfaceDescription(graph); - if(inf == null) return true; - return inf.isEmpty(); - - } - - @Override - public boolean hasClassification(ReadGraph graph, String classification) throws DatabaseException { - - PropertyInfo info = graph.syncRequest(new PropertyInfoRequest(getConnectionPointResource(graph)), TransientCacheAsyncListener.instance()); - return info.hasClassification(classification); - - } - - @Override - public String getRelativeRVI(ReadGraph graph, Variable base) throws DatabaseException { - - String var = getURI(graph); - String baseURI = base.getURI(graph); - return Variables.getRelativeRVI(baseURI, var); - - } - -} +package org.simantics.structural2.variables; + +import java.util.Collection; + +import org.simantics.db.ReadGraph; +import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; +import org.simantics.db.common.request.UnaryRead; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.request.PropertyInfo; +import org.simantics.db.layer0.request.PropertyInfoRequest; +import org.simantics.db.layer0.variable.Variable; +import org.simantics.db.layer0.variable.Variables; +import org.simantics.structural2.Functions; +import org.simantics.structural2.Functions.InterfaceResolution; + +abstract public class AbstractVariableConnectionPointDescriptor implements VariableConnectionPointDescriptor { + + static class ComputeInterfaceDescription extends UnaryRead> { + + public ComputeInterfaceDescription(AbstractVariableConnectionPointDescriptor desc) { + super(desc); + } + + @Override + public Collection perform(ReadGraph graph) throws DatabaseException { + return Functions.computeInterfacePaths(graph, parameter.getVariable(graph).getParent(graph)); + } + + } + + @Override + public Collection getInterfaceDescription(ReadGraph graph) throws DatabaseException { + return graph.syncRequest(new ComputeInterfaceDescription(this), TransientCacheAsyncListener.>instance()); + } + + @Override + public boolean isLeaf(ReadGraph graph) throws DatabaseException { + + Collection inf = getInterfaceDescription(graph); + if(inf == null) return true; + return inf.isEmpty(); + + } + + @Override + public boolean hasClassification(ReadGraph graph, String classification) throws DatabaseException { + + PropertyInfo info = graph.syncRequest(new PropertyInfoRequest(getConnectionPointResource(graph)), TransientCacheAsyncListener.instance()); + return info.hasClassification(classification); + + } + + @Override + public String getRelativeRVI(ReadGraph graph, Variable base) throws DatabaseException { + + String var = getURI(graph); + String baseURI = base.getURI(graph); + return Variables.getRelativeRVI(baseURI, var); + + } + +}