+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class BranchControlPoint extends Entity implements IBranchControlPoint {\r
- \r
- public BranchControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public BranchControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static BranchControlPoint createDefault(Graph graph) {\r
- return new BranchControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).BranchControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).BranchControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.FixedLengthControlPoint toFixedLengthControlPoint() {\r
- return new org.simantics.processeditor.stubs.FixedLengthControlPoint(graph, resource);\r
- }\r
- \r
- public BranchControlPoint toBranchControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineControlPoint toInlineControlPoint() {\r
- return new org.simantics.processeditor.stubs.InlineControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class BranchEndControlPoint extends Entity implements IBranchEndControlPoint {\r
- \r
- public BranchEndControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public BranchEndControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static BranchEndControlPoint createDefault(Graph graph) {\r
- return new BranchEndControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).BranchEndControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).BranchEndControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PathLegEndControlPoint toPathLegEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.PathLegEndControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.RunEndControlPoint toRunEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.RunEndControlPoint(graph, resource);\r
- }\r
- \r
- public BranchEndControlPoint toBranchEndControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.UndirectedControlPoint toUndirectedControlPoint() {\r
- return new org.simantics.processeditor.stubs.UndirectedControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class BranchSplitComponent extends Entity implements IBranchSplitComponent {\r
- \r
- public BranchSplitComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public BranchSplitComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static BranchSplitComponent createDefault(Graph graph) {\r
- return new BranchSplitComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).BranchSplitComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).BranchSplitComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.NonVisibleComponent toNonVisibleComponent() {\r
- return new org.simantics.processeditor.stubs.NonVisibleComponent(graph, resource);\r
- }\r
- \r
- public BranchSplitComponent toBranchSplitComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineComponent toInlineComponent() {\r
- return new org.simantics.processeditor.stubs.InlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.FixedLengthInlineComponent toFixedLengthInlineComponent() {\r
- return new org.simantics.processeditor.stubs.FixedLengthInlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class CodedComponent extends Entity implements ICodedComponent {\r
- \r
- public CodedComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public CodedComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static CodedComponent createDefault(Graph graph) {\r
- return new CodedComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).CodedComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).CodedComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public CodedComponent toCodedComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class ConcentricReducer extends Entity implements IConcentricReducer {\r
- \r
- public ConcentricReducer(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public ConcentricReducer(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static ConcentricReducer createDefault(Graph graph) {\r
- return new ConcentricReducer(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ConcentricReducer));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ConcentricReducer;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.CodedComponent toCodedComponent() {\r
- return new org.simantics.processeditor.stubs.CodedComponent(graph, resource);\r
- }\r
- \r
- public ConcentricReducer toConcentricReducer() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.Reducer toReducer() {\r
- return new org.simantics.processeditor.stubs.Reducer(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.SizeChangeComponent toSizeChangeComponent() {\r
- return new org.simantics.processeditor.stubs.SizeChangeComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineComponent toInlineComponent() {\r
- return new org.simantics.processeditor.stubs.InlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.DualConnectedComponent toDualConnectedComponent() {\r
- return new org.simantics.processeditor.stubs.DualConnectedComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.FixedLengthInlineComponent toFixedLengthInlineComponent() {\r
- return new org.simantics.processeditor.stubs.FixedLengthInlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class DirectedControlPoint extends Entity implements IDirectedControlPoint {\r
- \r
- public DirectedControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public DirectedControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static DirectedControlPoint createDefault(Graph graph) {\r
- return new DirectedControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).DirectedControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).DirectedControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PathLegEndControlPoint toPathLegEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.PathLegEndControlPoint(graph, resource);\r
- }\r
- \r
- public DirectedControlPoint toDirectedControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.RunEndControlPoint toRunEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.RunEndControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class DualConnectedComponent extends Entity implements IDualConnectedComponent {\r
- \r
- public DualConnectedComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public DualConnectedComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static DualConnectedComponent createDefault(Graph graph) {\r
- return new DualConnectedComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).DualConnectedComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).DualConnectedComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public DualConnectedComponent toDualConnectedComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class DualInlineControlPoint extends Entity implements IDualInlineControlPoint {\r
- \r
- public DualInlineControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public DualInlineControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static DualInlineControlPoint createDefault(Graph graph) {\r
- return new DualInlineControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).DualInlineControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).DualInlineControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.FixedLengthControlPoint toFixedLengthControlPoint() {\r
- return new org.simantics.processeditor.stubs.FixedLengthControlPoint(graph, resource);\r
- }\r
- \r
- public DualInlineControlPoint toDualInlineControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineControlPoint toInlineControlPoint() {\r
- return new org.simantics.processeditor.stubs.InlineControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class DualSubControlPoint extends Entity implements IDualSubControlPoint {\r
- \r
- public DualSubControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public DualSubControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static DualSubControlPoint createDefault(Graph graph) {\r
- return new DualSubControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).DualSubControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).DualSubControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.FixedLengthControlPoint toFixedLengthControlPoint() {\r
- return new org.simantics.processeditor.stubs.FixedLengthControlPoint(graph, resource);\r
- }\r
- \r
- public DualSubControlPoint toDualSubControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineControlPoint toInlineControlPoint() {\r
- return new org.simantics.processeditor.stubs.InlineControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class EccentricReducer extends Entity implements IEccentricReducer {\r
- \r
- public EccentricReducer(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public EccentricReducer(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static EccentricReducer createDefault(Graph graph) {\r
- return new EccentricReducer(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).EccentricReducer));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).EccentricReducer;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.CodedComponent toCodedComponent() {\r
- return new org.simantics.processeditor.stubs.CodedComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.OffsetComponent toOffsetComponent() {\r
- return new org.simantics.processeditor.stubs.OffsetComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.Reducer toReducer() {\r
- return new org.simantics.processeditor.stubs.Reducer(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.SizeChangeComponent toSizeChangeComponent() {\r
- return new org.simantics.processeditor.stubs.SizeChangeComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineComponent toInlineComponent() {\r
- return new org.simantics.processeditor.stubs.InlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.DualConnectedComponent toDualConnectedComponent() {\r
- return new org.simantics.processeditor.stubs.DualConnectedComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.FixedLengthInlineComponent toFixedLengthInlineComponent() {\r
- return new org.simantics.processeditor.stubs.FixedLengthInlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public EccentricReducer toEccentricReducer() {\r
- return this;\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class Elbow extends Entity implements IElbow {\r
- \r
- public Elbow(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public Elbow(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static Elbow createDefault(Graph graph) {\r
- return new Elbow(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Elbow));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Elbow;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.CodedComponent toCodedComponent() {\r
- return new org.simantics.processeditor.stubs.CodedComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.VariableAngleTurnComponent toVariableAngleTurnComponent() {\r
- return new org.simantics.processeditor.stubs.VariableAngleTurnComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.DualConnectedComponent toDualConnectedComponent() {\r
- return new org.simantics.processeditor.stubs.DualConnectedComponent(graph, resource);\r
- }\r
- \r
- public Elbow toElbow() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.TurnComponent toTurnComponent() {\r
- return new org.simantics.processeditor.stubs.TurnComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getTurnRadius() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnRadius);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setTurnRadius(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnRadius;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getTurnAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setTurnAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class EndComponent extends Entity implements IEndComponent {\r
- \r
- public EndComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public EndComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static EndComponent createDefault(Graph graph) {\r
- return new EndComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).EndComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).EndComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public EndComponent toEndComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class EndComponentControlPoint extends Entity implements IEndComponentControlPoint {\r
- \r
- public EndComponentControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public EndComponentControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static EndComponentControlPoint createDefault(Graph graph) {\r
- return new EndComponentControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).EndComponentControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).EndComponentControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PathLegEndControlPoint toPathLegEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.PathLegEndControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.RunEndControlPoint toRunEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.RunEndControlPoint(graph, resource);\r
- }\r
- \r
- public EndComponentControlPoint toEndComponentControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.UndirectedControlPoint toUndirectedControlPoint() {\r
- return new org.simantics.processeditor.stubs.UndirectedControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class Equipment extends Entity implements IEquipment {\r
- \r
- public Equipment(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public Equipment(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static Equipment createDefault(Graph graph) {\r
- return new Equipment(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Equipment));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Equipment;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public Equipment toEquipment() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.Nozzle getNozzle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.Nozzle(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNozzle(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle, v.getResource());\r
- }\r
- \r
- public void setNozzle(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle]&[Property]\r
- public Collection<org.simantics.layer0.utils.IEntity> getNozzleDefinition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleDefinition);\r
- Collection<org.simantics.layer0.utils.IEntity> ret = new ArrayList<org.simantics.layer0.utils.IEntity>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new Entity(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- // [Nozzle]&[Property]\r
- public void addNozzleDefinition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleDefinition, v.getResource());\r
- }\r
- \r
- public String[] getNozzleRestriction() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleRestriction);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return (String[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setNozzleRestriction(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleRestriction;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).IntegerRangeUnion;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class FixedAngleTurnComponent extends Entity implements IFixedAngleTurnComponent {\r
- \r
- public FixedAngleTurnComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public FixedAngleTurnComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static FixedAngleTurnComponent createDefault(Graph graph) {\r
- return new FixedAngleTurnComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).FixedAngleTurnComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).FixedAngleTurnComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public FixedAngleTurnComponent toFixedAngleTurnComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.TurnComponent toTurnComponent() {\r
- return new org.simantics.processeditor.stubs.TurnComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getTurnAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setTurnAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class FixedAngleTurnControlPoint extends Entity implements IFixedAngleTurnControlPoint {\r
- \r
- public FixedAngleTurnControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public FixedAngleTurnControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static FixedAngleTurnControlPoint createDefault(Graph graph) {\r
- return new FixedAngleTurnControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).FixedAngleTurnControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).FixedAngleTurnControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PathLegEndControlPoint toPathLegEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.PathLegEndControlPoint(graph, resource);\r
- }\r
- \r
- public FixedAngleTurnControlPoint toFixedAngleTurnControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.TurnControlPoint toTurnControlPoint() {\r
- return new org.simantics.processeditor.stubs.TurnControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getTurnAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setTurnAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public boolean[] getIsReversed() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).IsReversed);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (boolean[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setIsReversed(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).IsReversed;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Boolean;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class FixedLengthControlPoint extends Entity implements IFixedLengthControlPoint {\r
- \r
- public FixedLengthControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public FixedLengthControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static FixedLengthControlPoint createDefault(Graph graph) {\r
- return new FixedLengthControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).FixedLengthControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).FixedLengthControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public FixedLengthControlPoint toFixedLengthControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineControlPoint toInlineControlPoint() {\r
- return new org.simantics.processeditor.stubs.InlineControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class FixedLengthInlineComponent extends Entity implements IFixedLengthInlineComponent {\r
- \r
- public FixedLengthInlineComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public FixedLengthInlineComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static FixedLengthInlineComponent createDefault(Graph graph) {\r
- return new FixedLengthInlineComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).FixedLengthInlineComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).FixedLengthInlineComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineComponent toInlineComponent() {\r
- return new org.simantics.processeditor.stubs.InlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public FixedLengthInlineComponent toFixedLengthInlineComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class HorizontalVessel extends Entity implements IHorizontalVessel {\r
- \r
- public HorizontalVessel(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public HorizontalVessel(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static HorizontalVessel createDefault(Graph graph) {\r
- return new HorizontalVessel(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HorizontalVessel));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HorizontalVessel;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public HorizontalVessel toHorizontalVessel() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.Vessel toVessel() {\r
- return new org.simantics.processeditor.stubs.Vessel(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.Equipment toEquipment() {\r
- return new org.simantics.processeditor.stubs.Equipment(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.Nozzle getNozzle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.Nozzle(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNozzle(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle, v.getResource());\r
- }\r
- \r
- public void setNozzle(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle]&[Property]\r
- public Collection<org.simantics.layer0.utils.IEntity> getNozzleDefinition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleDefinition);\r
- Collection<org.simantics.layer0.utils.IEntity> ret = new ArrayList<org.simantics.layer0.utils.IEntity>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new Entity(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- // [Nozzle]&[Property]\r
- public void addNozzleDefinition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleDefinition, v.getResource());\r
- }\r
- \r
- public String[] getNozzleRestriction() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleRestriction);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return (String[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setNozzleRestriction(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleRestriction;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).IntegerRangeUnion;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IBranchControlPoint extends org.simantics.processeditor.stubs.IFixedLengthControlPoint {\r
- BranchControlPoint toBranchControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IBranchEndControlPoint extends org.simantics.processeditor.stubs.IUndirectedControlPoint {\r
- BranchEndControlPoint toBranchEndControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IBranchSplitComponent extends org.simantics.processeditor.stubs.INonVisibleComponent, org.simantics.processeditor.stubs.IFixedLengthInlineComponent {\r
- BranchSplitComponent toBranchSplitComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface ICodedComponent extends org.simantics.processeditor.stubs.IPipelineComponent {\r
- CodedComponent toCodedComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IConcentricReducer extends org.simantics.processeditor.stubs.IReducer {\r
- ConcentricReducer toConcentricReducer();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IDirectedControlPoint extends org.simantics.processeditor.stubs.IRunEndControlPoint {\r
- DirectedControlPoint toDirectedControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IDualConnectedComponent extends org.simantics.processeditor.stubs.IPipelineComponent {\r
- DualConnectedComponent toDualConnectedComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IDualInlineControlPoint extends org.simantics.processeditor.stubs.IFixedLengthControlPoint {\r
- DualInlineControlPoint toDualInlineControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IDualSubControlPoint extends org.simantics.processeditor.stubs.IFixedLengthControlPoint {\r
- DualSubControlPoint toDualSubControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IEccentricReducer extends org.simantics.processeditor.stubs.IOffsetComponent, org.simantics.processeditor.stubs.IReducer {\r
- EccentricReducer toEccentricReducer();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IElbow extends org.simantics.processeditor.stubs.IDualConnectedComponent, org.simantics.processeditor.stubs.IVariableAngleTurnComponent, org.simantics.processeditor.stubs.ICodedComponent {\r
- Elbow toElbow();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IEndComponent extends org.simantics.processeditor.stubs.IPipelineComponent {\r
- EndComponent toEndComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IEndComponentControlPoint extends org.simantics.processeditor.stubs.IUndirectedControlPoint {\r
- EndComponentControlPoint toEndComponentControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IEquipment extends org.simantics.processeditor.stubs.ILibraryComponent {\r
- Equipment toEquipment();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IFixedAngleTurnComponent extends org.simantics.processeditor.stubs.ITurnComponent {\r
- FixedAngleTurnComponent toFixedAngleTurnComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IFixedAngleTurnControlPoint extends org.simantics.processeditor.stubs.ITurnControlPoint {\r
- FixedAngleTurnControlPoint toFixedAngleTurnControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IFixedLengthControlPoint extends org.simantics.processeditor.stubs.IInlineControlPoint {\r
- FixedLengthControlPoint toFixedLengthControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IFixedLengthInlineComponent extends org.simantics.processeditor.stubs.IInlineComponent {\r
- FixedLengthInlineComponent toFixedLengthInlineComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IHorizontalVessel extends org.simantics.processeditor.stubs.IVessel {\r
- HorizontalVessel toHorizontalVessel();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IInlineComponent extends org.simantics.processeditor.stubs.IPipelineComponent {\r
- InlineComponent toInlineComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IInlineControlPoint extends org.simantics.processeditor.stubs.IPipeControlPoint {\r
- InlineControlPoint toInlineControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface ILibraryComponent extends org.simantics.processeditor.stubs.IPBSNode, org.simantics.processeditor.stubs.IP3DNode {\r
- LibraryComponent toLibraryComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IMultiConnectedComponent extends org.simantics.processeditor.stubs.IPipelineComponent {\r
- MultiConnectedComponent toMultiConnectedComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface INPortControlPoint extends org.simantics.processeditor.stubs.IDirectedControlPoint {\r
- NPortControlPoint toNPortControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface INonVisibleComponent extends org.simantics.processeditor.stubs.IPipelineComponent {\r
- NonVisibleComponent toNonVisibleComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface INozzle extends org.simantics.processeditor.stubs.ILibraryComponent {\r
- Nozzle toNozzle();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface INozzleControlPoint extends org.simantics.processeditor.stubs.IDirectedControlPoint {\r
- NozzleControlPoint toNozzleControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IOffsetComponent extends org.simantics.processeditor.stubs.IFixedLengthInlineComponent {\r
- OffsetComponent toOffsetComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IOffsettingPoint extends org.simantics.processeditor.stubs.IDualInlineControlPoint {\r
- OffsettingPoint toOffsettingPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IP3DNode extends org.simantics.proconf.g3d.stubs.IG3DNode {\r
- P3DNode toP3DNode();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IPBSNode {\r
- PBSNode toPBSNode();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IPathLegEndControlPoint extends org.simantics.processeditor.stubs.IPipeControlPoint {\r
- PathLegEndControlPoint toPathLegEndControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IPipeControlPoint {\r
- PipeControlPoint toPipeControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IPipeRun extends org.simantics.processeditor.stubs.IP3DNode {\r
- PipeRun toPipeRun();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IPipelineComponent extends org.simantics.processeditor.stubs.ILibraryComponent {\r
- PipelineComponent toPipelineComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IPlant extends org.simantics.processeditor.stubs.IPBSNode, org.simantics.processeditor.stubs.IP3DNode {\r
- Plant toPlant();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IPlant3DProjectType extends org.simantics.layer0.stubs.IProjectType {\r
- Plant3DProjectType toPlant3DProjectType();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IReducer extends org.simantics.processeditor.stubs.IDualConnectedComponent, org.simantics.processeditor.stubs.IFixedLengthInlineComponent, org.simantics.processeditor.stubs.ISizeChangeComponent, org.simantics.processeditor.stubs.ICodedComponent {\r
- Reducer toReducer();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IRunEndControlPoint extends org.simantics.processeditor.stubs.IPathLegEndControlPoint {\r
- RunEndControlPoint toRunEndControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface ISingleConnectedComponent extends org.simantics.processeditor.stubs.IPipelineComponent {\r
- SingleConnectedComponent toSingleConnectedComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface ISizeChangeComponent extends org.simantics.processeditor.stubs.IFixedLengthInlineComponent {\r
- SizeChangeComponent toSizeChangeComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface ISizeChangeControlPoint extends org.simantics.processeditor.stubs.IDualInlineControlPoint {\r
- SizeChangeControlPoint toSizeChangeControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IStraight extends org.simantics.processeditor.stubs.IVariableLengthInlineComponent, org.simantics.processeditor.stubs.IDualConnectedComponent, org.simantics.processeditor.stubs.ICodedComponent {\r
- Straight toStraight();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface ITurnComponent extends org.simantics.processeditor.stubs.IPipelineComponent {\r
- TurnComponent toTurnComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface ITurnControlPoint extends org.simantics.processeditor.stubs.IPathLegEndControlPoint {\r
- TurnControlPoint toTurnControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IUndirectedControlPoint extends org.simantics.processeditor.stubs.IRunEndControlPoint {\r
- UndirectedControlPoint toUndirectedControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IVariableAngleTurnComponent extends org.simantics.processeditor.stubs.ITurnComponent {\r
- VariableAngleTurnComponent toVariableAngleTurnComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IVariableAngleTurnControlPoint extends org.simantics.processeditor.stubs.ITurnControlPoint {\r
- VariableAngleTurnControlPoint toVariableAngleTurnControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IVariableLengthControlPoint extends org.simantics.processeditor.stubs.IInlineControlPoint {\r
- VariableLengthControlPoint toVariableLengthControlPoint();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IVariableLengthInlineComponent extends org.simantics.processeditor.stubs.IInlineComponent {\r
- VariableLengthInlineComponent toVariableLengthInlineComponent();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IVerticalVessel extends org.simantics.processeditor.stubs.IVessel {\r
- VerticalVessel toVerticalVessel();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-public interface IVessel extends org.simantics.processeditor.stubs.IEquipment {\r
- Vessel toVessel();\r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class InlineComponent extends Entity implements IInlineComponent {\r
- \r
- public InlineComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public InlineComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static InlineComponent createDefault(Graph graph) {\r
- return new InlineComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).InlineComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).InlineComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public InlineComponent toInlineComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class InlineControlPoint extends Entity implements IInlineControlPoint {\r
- \r
- public InlineControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public InlineControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static InlineControlPoint createDefault(Graph graph) {\r
- return new InlineControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).InlineControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).InlineControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public InlineControlPoint toInlineControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class LibraryComponent extends Entity implements ILibraryComponent {\r
- \r
- public LibraryComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public LibraryComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static LibraryComponent createDefault(Graph graph) {\r
- return new LibraryComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).LibraryComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).LibraryComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public LibraryComponent toLibraryComponent() {\r
- return this;\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class MultiConnectedComponent extends Entity implements IMultiConnectedComponent {\r
- \r
- public MultiConnectedComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public MultiConnectedComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static MultiConnectedComponent createDefault(Graph graph) {\r
- return new MultiConnectedComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).MultiConnectedComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).MultiConnectedComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public MultiConnectedComponent toMultiConnectedComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class NPortControlPoint extends Entity implements INPortControlPoint {\r
- \r
- public NPortControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public NPortControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static NPortControlPoint createDefault(Graph graph) {\r
- return new NPortControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).NPortControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).NPortControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PathLegEndControlPoint toPathLegEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.PathLegEndControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.DirectedControlPoint toDirectedControlPoint() {\r
- return new org.simantics.processeditor.stubs.DirectedControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.RunEndControlPoint toRunEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.RunEndControlPoint(graph, resource);\r
- }\r
- \r
- public NPortControlPoint toNPortControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class NonVisibleComponent extends Entity implements INonVisibleComponent {\r
- \r
- public NonVisibleComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public NonVisibleComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static NonVisibleComponent createDefault(Graph graph) {\r
- return new NonVisibleComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).NonVisibleComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).NonVisibleComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public NonVisibleComponent toNonVisibleComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class Nozzle extends Entity implements INozzle {\r
- \r
- public Nozzle(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public Nozzle(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static Nozzle createDefault(Graph graph) {\r
- return new Nozzle(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Nozzle));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Nozzle;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Nozzle toNozzle() {\r
- return this;\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class NozzleControlPoint extends Entity implements INozzleControlPoint {\r
- \r
- public NozzleControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public NozzleControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static NozzleControlPoint createDefault(Graph graph) {\r
- return new NozzleControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).NozzleControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).NozzleControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PathLegEndControlPoint toPathLegEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.PathLegEndControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.DirectedControlPoint toDirectedControlPoint() {\r
- return new org.simantics.processeditor.stubs.DirectedControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.RunEndControlPoint toRunEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.RunEndControlPoint(graph, resource);\r
- }\r
- \r
- public NozzleControlPoint toNozzleControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class OffsetComponent extends Entity implements IOffsetComponent {\r
- \r
- public OffsetComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public OffsetComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static OffsetComponent createDefault(Graph graph) {\r
- return new OffsetComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).OffsetComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).OffsetComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public OffsetComponent toOffsetComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineComponent toInlineComponent() {\r
- return new org.simantics.processeditor.stubs.InlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.FixedLengthInlineComponent toFixedLengthInlineComponent() {\r
- return new org.simantics.processeditor.stubs.FixedLengthInlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class OffsettingPoint extends Entity implements IOffsettingPoint {\r
- \r
- public OffsettingPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public OffsettingPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static OffsettingPoint createDefault(Graph graph) {\r
- return new OffsettingPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).OffsettingPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).OffsettingPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.FixedLengthControlPoint toFixedLengthControlPoint() {\r
- return new org.simantics.processeditor.stubs.FixedLengthControlPoint(graph, resource);\r
- }\r
- \r
- public OffsettingPoint toOffsettingPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.DualInlineControlPoint toDualInlineControlPoint() {\r
- return new org.simantics.processeditor.stubs.DualInlineControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineControlPoint toInlineControlPoint() {\r
- return new org.simantics.processeditor.stubs.InlineControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getOffset() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasOffset);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setOffset(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasOffset;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class P3DNode extends Entity implements IP3DNode {\r
- \r
- public P3DNode(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public P3DNode(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static P3DNode createDefault(Graph graph) {\r
- return new P3DNode(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).P3DNode));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).P3DNode;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public P3DNode toP3DNode() {\r
- return this;\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class PBSNode extends Entity implements IPBSNode {\r
- \r
- public PBSNode(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public PBSNode(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static PBSNode createDefault(Graph graph) {\r
- return new PBSNode(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).PBSNode));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).PBSNode;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public PBSNode toPBSNode() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class PathLegEndControlPoint extends Entity implements IPathLegEndControlPoint {\r
- \r
- public PathLegEndControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public PathLegEndControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static PathLegEndControlPoint createDefault(Graph graph) {\r
- return new PathLegEndControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).PathLegEndControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).PathLegEndControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public PathLegEndControlPoint toPathLegEndControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class PipeControlPoint extends Entity implements IPipeControlPoint {\r
- \r
- public PipeControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public PipeControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static PipeControlPoint createDefault(Graph graph) {\r
- return new PipeControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).PipeControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).PipeControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public PipeControlPoint toPipeControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class PipeRun extends Entity implements IPipeRun {\r
- \r
- public PipeRun(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public PipeRun(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static PipeRun createDefault(Graph graph) {\r
- return new PipeRun(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).PipeRun));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).PipeRun;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public PipeRun toPipeRun() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getTurnRadius() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnRadius);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setTurnRadius(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnRadius;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getControlPoints() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoints);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addControlPoints(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoints, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class PipelineComponent extends Entity implements IPipelineComponent {\r
- \r
- public PipelineComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public PipelineComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static PipelineComponent createDefault(Graph graph) {\r
- return new PipelineComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).PipelineComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).PipelineComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public PipelineComponent toPipelineComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class Plant extends Entity implements IPlant {\r
- \r
- public Plant(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public Plant(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static Plant createDefault(Graph graph) {\r
- return new Plant(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Plant));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Plant;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public Plant toPlant() {\r
- return this;\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class Plant3DProjectType extends Entity implements IPlant3DProjectType {\r
- \r
- public Plant3DProjectType(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public Plant3DProjectType(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static Plant3DProjectType createDefault(Graph graph) {\r
- return new Plant3DProjectType(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Plant3DProjectType));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Plant3DProjectType;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public Plant3DProjectType toPlant3DProjectType() {\r
- return this;\r
- }\r
- \r
- public org.simantics.layer0.stubs.ProjectType toProjectType() {\r
- return new org.simantics.layer0.stubs.ProjectType(graph, resource);\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Session;\r
-import org.simantics.db.exceptions.Layer0MissingException;\r
-import org.simantics.db.exceptions.ResourceNotFoundException;\r
-\r
-public class Plant3DResource {\r
- \r
- public final Resource BranchControlPoint;\r
- public final Resource BranchEndControlPoint;\r
- public final Resource BranchSplitComponent;\r
- public final Resource CodedComponent;\r
- public final Resource ConcentricReducer;\r
- public final Resource ControlPointOf;\r
- public final Resource ControlPointOfPipeRun;\r
- public final Resource DirectedControlPoint;\r
- public final Resource DualConnectedComponent;\r
- public final Resource DualInlineControlPoint;\r
- public final Resource DualSubControlPoint;\r
- public final Resource EccentricReducer;\r
- public final Resource Elbow;\r
- public final Resource EndComponent;\r
- public final Resource EndComponentControlPoint;\r
- public final Resource Equipment;\r
- public final Resource FixedAngleTurnComponent;\r
- public final Resource FixedAngleTurnControlPoint;\r
- public final Resource FixedLengthControlPoint;\r
- public final Resource FixedLengthInlineComponent;\r
- public final Resource HasChildStructure;\r
- public final Resource HasControlPoint;\r
- public final Resource HasControlPoints;\r
- public final Resource HasGraphics;\r
- public final Resource HasHeight;\r
- public final Resource HasLength;\r
- public final Resource HasNext;\r
- public final Resource HasNozzle;\r
- public final Resource HasNozzleDefinition;\r
- public final Resource HasNozzleRestriction;\r
- public final Resource HasOffset;\r
- public final Resource HasParentStructure;\r
- public final Resource HasPipeDiameter;\r
- public final Resource HasPrevious;\r
- public final Resource HasRotationAngle;\r
- public final Resource HasSubPoint;\r
- public final Resource HasTurnAngle;\r
- public final Resource HasTurnAxis;\r
- public final Resource HasTurnRadius;\r
- public final Resource HorizontalVessel;\r
- public final Resource InlineComponent;\r
- public final Resource InlineControlPoint;\r
- public final Resource IsReversed;\r
- public final Resource LibraryComponent;\r
- public final Resource MultiConnectedComponent;\r
- public final Resource NPortControlPoint;\r
- public final Resource NonVisibleComponent;\r
- public final Resource Nozzle;\r
- public final Resource NozzleControlPoint;\r
- public final Resource NozzleOf;\r
- public final Resource OffsetComponent;\r
- public final Resource OffsettingPoint;\r
- public final Resource P3DNode;\r
- public final Resource PBSNode;\r
- public final Resource PathLegEndControlPoint;\r
- public final Resource PipeControlPoint;\r
- public final Resource PipeRun;\r
- public final Resource PipelineComponent;\r
- public final Resource Plant;\r
- public final Resource Plant3DProjectType;\r
- public final Resource Reducer;\r
- public final Resource RunEndControlPoint;\r
- public final Resource SingleConnectedComponent;\r
- public final Resource SizeChangeComponent;\r
- public final Resource SizeChangeControlPoint;\r
- public final Resource Straight;\r
- public final Resource SubPointOf;\r
- public final Resource TurnComponent;\r
- public final Resource TurnControlPoint;\r
- public final Resource UndirectedControlPoint;\r
- public final Resource VariableAngleTurnComponent;\r
- public final Resource VariableAngleTurnControlPoint;\r
- public final Resource VariableLengthControlPoint;\r
- public final Resource VariableLengthInlineComponent;\r
- public final Resource VerticalVessel;\r
- public final Resource Vessel;\r
- \r
- public static class URIs {\r
- public static final String BranchControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#BranchControlPoint";\r
- public static final String BranchEndControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#BranchEndControlPoint";\r
- public static final String BranchSplitComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0#BranchSplitComponent";\r
- public static final String CodedComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#CodedComponent";\r
- public static final String ConcentricReducer = "http://www.vtt.fi/Simantics/Plant3D/1.0#ConcentricReducer";\r
- public static final String ControlPointOf = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#ControlPointOf";\r
- public static final String ControlPointOfPipeRun = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#ControlPointOfPipeRun";\r
- public static final String DirectedControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#DirectedControlPoint";\r
- public static final String DualConnectedComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#DualConnectedComponent";\r
- public static final String DualInlineControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#DualInlineControlPoint";\r
- public static final String DualSubControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#DualSubControlPoint";\r
- public static final String EccentricReducer = "http://www.vtt.fi/Simantics/Plant3D/1.0#EccentricReducer";\r
- public static final String Elbow = "http://www.vtt.fi/Simantics/Plant3D/1.0#Elbow";\r
- public static final String EndComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#EndComponent";\r
- public static final String EndComponentControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#EndComponentControlPoint";\r
- public static final String Equipment = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#Equipment";\r
- public static final String FixedAngleTurnComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#FixedAngleTurnComponent";\r
- public static final String FixedAngleTurnControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#FixedAngleTurnControlPoint";\r
- public static final String FixedLengthControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#FixedLengthControlPoint";\r
- public static final String FixedLengthInlineComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#FixedLengthInlineComponent";\r
- public static final String HasChildStructure = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasChildStructure";\r
- public static final String HasControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasControlPoint";\r
- public static final String HasControlPoints = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasControlPoints";\r
- public static final String HasGraphics = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasGraphics";\r
- public static final String HasHeight = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasHeight";\r
- public static final String HasLength = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasLength";\r
- public static final String HasNext = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasNext";\r
- public static final String HasNozzle = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasNozzle";\r
- public static final String HasNozzleDefinition = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasNozzleDefinition";\r
- public static final String HasNozzleRestriction = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasNozzleRestriction";\r
- public static final String HasOffset = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasOffset";\r
- public static final String HasParentStructure = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasParentStructure";\r
- public static final String HasPipeDiameter = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasPipeDiameter";\r
- public static final String HasPrevious = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasPrevious";\r
- public static final String HasRotationAngle = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasRotationAngle";\r
- public static final String HasSubPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasSubPoint";\r
- public static final String HasTurnAngle = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasTurnAngle";\r
- public static final String HasTurnAxis = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasTurnAxis";\r
- public static final String HasTurnRadius = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#HasTurnRadius";\r
- public static final String HorizontalVessel = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#HorizontalVessel";\r
- public static final String InlineComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#InlineComponent";\r
- public static final String InlineControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#InlineControlPoint";\r
- public static final String IsReversed = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#IsReversed";\r
- public static final String LibraryComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#LibraryComponent";\r
- public static final String MultiConnectedComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#MultiConnectedComponent";\r
- public static final String NPortControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#NPortControlPoint";\r
- public static final String NonVisibleComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#NonVisibleComponent";\r
- public static final String Nozzle = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#Nozzle";\r
- public static final String NozzleControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#NozzleControlPoint";\r
- public static final String NozzleOf = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#NozzleOf";\r
- public static final String OffsetComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#OffsetComponent";\r
- public static final String OffsettingPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#OffsettingPoint";\r
- public static final String P3DNode = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#P3DNode";\r
- public static final String PBSNode = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#PBSNode";\r
- public static final String PathLegEndControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#PathLegEndControlPoint";\r
- public static final String PipeControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#PipeControlPoint";\r
- public static final String PipeRun = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#PipeRun";\r
- public static final String PipelineComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#PipelineComponent";\r
- public static final String Plant = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#Plant";\r
- public static final String Plant3DProjectType = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#Plant3DProjectType";\r
- public static final String Reducer = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#Reducer";\r
- public static final String RunEndControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#RunEndControlPoint";\r
- public static final String SingleConnectedComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#SingleConnectedComponent";\r
- public static final String SizeChangeComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#SizeChangeComponent";\r
- public static final String SizeChangeControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#SizeChangeControlPoint";\r
- public static final String Straight = "http://www.vtt.fi/Simantics/Plant3D/1.0#Straight";\r
- public static final String SubPointOf = "http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#SubPointOf";\r
- public static final String TurnComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#TurnComponent";\r
- public static final String TurnControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#TurnControlPoint";\r
- public static final String UndirectedControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#UndirectedControlPoint";\r
- public static final String VariableAngleTurnComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#VariableAngleTurnComponent";\r
- public static final String VariableAngleTurnControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#VariableAngleTurnControlPoint";\r
- public static final String VariableLengthControlPoint = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#VariableLengthControlPoint";\r
- public static final String VariableLengthInlineComponent = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#VariableLengthInlineComponent";\r
- public static final String VerticalVessel = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#VerticalVessel";\r
- public static final String Vessel = "http://www.vtt.fi/Simantics/Plant3D/1.0/Types#Vessel";\r
- }\r
- \r
- public Plant3DResource(Graph graph) throws Layer0MissingException {\r
- try {\r
- BranchControlPoint = graph.getResourceByURI(URIs.BranchControlPoint);\r
- BranchEndControlPoint = graph.getResourceByURI(URIs.BranchEndControlPoint);\r
- BranchSplitComponent = graph.getResourceByURI(URIs.BranchSplitComponent);\r
- CodedComponent = graph.getResourceByURI(URIs.CodedComponent);\r
- ConcentricReducer = graph.getResourceByURI(URIs.ConcentricReducer);\r
- ControlPointOf = graph.getResourceByURI(URIs.ControlPointOf);\r
- ControlPointOfPipeRun = graph.getResourceByURI(URIs.ControlPointOfPipeRun);\r
- DirectedControlPoint = graph.getResourceByURI(URIs.DirectedControlPoint);\r
- DualConnectedComponent = graph.getResourceByURI(URIs.DualConnectedComponent);\r
- DualInlineControlPoint = graph.getResourceByURI(URIs.DualInlineControlPoint);\r
- DualSubControlPoint = graph.getResourceByURI(URIs.DualSubControlPoint);\r
- EccentricReducer = graph.getResourceByURI(URIs.EccentricReducer);\r
- Elbow = graph.getResourceByURI(URIs.Elbow);\r
- EndComponent = graph.getResourceByURI(URIs.EndComponent);\r
- EndComponentControlPoint = graph.getResourceByURI(URIs.EndComponentControlPoint);\r
- Equipment = graph.getResourceByURI(URIs.Equipment);\r
- FixedAngleTurnComponent = graph.getResourceByURI(URIs.FixedAngleTurnComponent);\r
- FixedAngleTurnControlPoint = graph.getResourceByURI(URIs.FixedAngleTurnControlPoint);\r
- FixedLengthControlPoint = graph.getResourceByURI(URIs.FixedLengthControlPoint);\r
- FixedLengthInlineComponent = graph.getResourceByURI(URIs.FixedLengthInlineComponent);\r
- HasChildStructure = graph.getResourceByURI(URIs.HasChildStructure);\r
- HasControlPoint = graph.getResourceByURI(URIs.HasControlPoint);\r
- HasControlPoints = graph.getResourceByURI(URIs.HasControlPoints);\r
- HasGraphics = graph.getResourceByURI(URIs.HasGraphics);\r
- HasHeight = graph.getResourceByURI(URIs.HasHeight);\r
- HasLength = graph.getResourceByURI(URIs.HasLength);\r
- HasNext = graph.getResourceByURI(URIs.HasNext);\r
- HasNozzle = graph.getResourceByURI(URIs.HasNozzle);\r
- HasNozzleDefinition = graph.getResourceByURI(URIs.HasNozzleDefinition);\r
- HasNozzleRestriction = graph.getResourceByURI(URIs.HasNozzleRestriction);\r
- HasOffset = graph.getResourceByURI(URIs.HasOffset);\r
- HasParentStructure = graph.getResourceByURI(URIs.HasParentStructure);\r
- HasPipeDiameter = graph.getResourceByURI(URIs.HasPipeDiameter);\r
- HasPrevious = graph.getResourceByURI(URIs.HasPrevious);\r
- HasRotationAngle = graph.getResourceByURI(URIs.HasRotationAngle);\r
- HasSubPoint = graph.getResourceByURI(URIs.HasSubPoint);\r
- HasTurnAngle = graph.getResourceByURI(URIs.HasTurnAngle);\r
- HasTurnAxis = graph.getResourceByURI(URIs.HasTurnAxis);\r
- HasTurnRadius = graph.getResourceByURI(URIs.HasTurnRadius);\r
- HorizontalVessel = graph.getResourceByURI(URIs.HorizontalVessel);\r
- InlineComponent = graph.getResourceByURI(URIs.InlineComponent);\r
- InlineControlPoint = graph.getResourceByURI(URIs.InlineControlPoint);\r
- IsReversed = graph.getResourceByURI(URIs.IsReversed);\r
- LibraryComponent = graph.getResourceByURI(URIs.LibraryComponent);\r
- MultiConnectedComponent = graph.getResourceByURI(URIs.MultiConnectedComponent);\r
- NPortControlPoint = graph.getResourceByURI(URIs.NPortControlPoint);\r
- NonVisibleComponent = graph.getResourceByURI(URIs.NonVisibleComponent);\r
- Nozzle = graph.getResourceByURI(URIs.Nozzle);\r
- NozzleControlPoint = graph.getResourceByURI(URIs.NozzleControlPoint);\r
- NozzleOf = graph.getResourceByURI(URIs.NozzleOf);\r
- OffsetComponent = graph.getResourceByURI(URIs.OffsetComponent);\r
- OffsettingPoint = graph.getResourceByURI(URIs.OffsettingPoint);\r
- P3DNode = graph.getResourceByURI(URIs.P3DNode);\r
- PBSNode = graph.getResourceByURI(URIs.PBSNode);\r
- PathLegEndControlPoint = graph.getResourceByURI(URIs.PathLegEndControlPoint);\r
- PipeControlPoint = graph.getResourceByURI(URIs.PipeControlPoint);\r
- PipeRun = graph.getResourceByURI(URIs.PipeRun);\r
- PipelineComponent = graph.getResourceByURI(URIs.PipelineComponent);\r
- Plant = graph.getResourceByURI(URIs.Plant);\r
- Plant3DProjectType = graph.getResourceByURI(URIs.Plant3DProjectType);\r
- Reducer = graph.getResourceByURI(URIs.Reducer);\r
- RunEndControlPoint = graph.getResourceByURI(URIs.RunEndControlPoint);\r
- SingleConnectedComponent = graph.getResourceByURI(URIs.SingleConnectedComponent);\r
- SizeChangeComponent = graph.getResourceByURI(URIs.SizeChangeComponent);\r
- SizeChangeControlPoint = graph.getResourceByURI(URIs.SizeChangeControlPoint);\r
- Straight = graph.getResourceByURI(URIs.Straight);\r
- SubPointOf = graph.getResourceByURI(URIs.SubPointOf);\r
- TurnComponent = graph.getResourceByURI(URIs.TurnComponent);\r
- TurnControlPoint = graph.getResourceByURI(URIs.TurnControlPoint);\r
- UndirectedControlPoint = graph.getResourceByURI(URIs.UndirectedControlPoint);\r
- VariableAngleTurnComponent = graph.getResourceByURI(URIs.VariableAngleTurnComponent);\r
- VariableAngleTurnControlPoint = graph.getResourceByURI(URIs.VariableAngleTurnControlPoint);\r
- VariableLengthControlPoint = graph.getResourceByURI(URIs.VariableLengthControlPoint);\r
- VariableLengthInlineComponent = graph.getResourceByURI(URIs.VariableLengthInlineComponent);\r
- VerticalVessel = graph.getResourceByURI(URIs.VerticalVessel);\r
- Vessel = graph.getResourceByURI(URIs.Vessel);\r
- } catch(ResourceNotFoundException e) {\r
- throw new Layer0MissingException(e);\r
- }\r
- }\r
- \r
- public static Plant3DResource getInstance(Graph graph) {\r
- Session session = graph.getSession();\r
- Plant3DResource ret = session.getService(Plant3DResource.class);\r
- if(ret == null) {\r
- ret = new Plant3DResource(graph);\r
- session.registerService(Plant3DResource.class, ret);\r
- }\r
- return ret;\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class Reducer extends Entity implements IReducer {\r
- \r
- public Reducer(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public Reducer(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static Reducer createDefault(Graph graph) {\r
- return new Reducer(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Reducer));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Reducer;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.CodedComponent toCodedComponent() {\r
- return new org.simantics.processeditor.stubs.CodedComponent(graph, resource);\r
- }\r
- \r
- public Reducer toReducer() {\r
- return this;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.SizeChangeComponent toSizeChangeComponent() {\r
- return new org.simantics.processeditor.stubs.SizeChangeComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineComponent toInlineComponent() {\r
- return new org.simantics.processeditor.stubs.InlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.DualConnectedComponent toDualConnectedComponent() {\r
- return new org.simantics.processeditor.stubs.DualConnectedComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.FixedLengthInlineComponent toFixedLengthInlineComponent() {\r
- return new org.simantics.processeditor.stubs.FixedLengthInlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class RunEndControlPoint extends Entity implements IRunEndControlPoint {\r
- \r
- public RunEndControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public RunEndControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static RunEndControlPoint createDefault(Graph graph) {\r
- return new RunEndControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).RunEndControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).RunEndControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PathLegEndControlPoint toPathLegEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.PathLegEndControlPoint(graph, resource);\r
- }\r
- \r
- public RunEndControlPoint toRunEndControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class SingleConnectedComponent extends Entity implements ISingleConnectedComponent {\r
- \r
- public SingleConnectedComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public SingleConnectedComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static SingleConnectedComponent createDefault(Graph graph) {\r
- return new SingleConnectedComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SingleConnectedComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SingleConnectedComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public SingleConnectedComponent toSingleConnectedComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class SizeChangeComponent extends Entity implements ISizeChangeComponent {\r
- \r
- public SizeChangeComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public SizeChangeComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static SizeChangeComponent createDefault(Graph graph) {\r
- return new SizeChangeComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SizeChangeComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SizeChangeComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public SizeChangeComponent toSizeChangeComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineComponent toInlineComponent() {\r
- return new org.simantics.processeditor.stubs.InlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.FixedLengthInlineComponent toFixedLengthInlineComponent() {\r
- return new org.simantics.processeditor.stubs.FixedLengthInlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class SizeChangeControlPoint extends Entity implements ISizeChangeControlPoint {\r
- \r
- public SizeChangeControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public SizeChangeControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static SizeChangeControlPoint createDefault(Graph graph) {\r
- return new SizeChangeControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SizeChangeControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SizeChangeControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.FixedLengthControlPoint toFixedLengthControlPoint() {\r
- return new org.simantics.processeditor.stubs.FixedLengthControlPoint(graph, resource);\r
- }\r
- \r
- public SizeChangeControlPoint toSizeChangeControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.DualInlineControlPoint toDualInlineControlPoint() {\r
- return new org.simantics.processeditor.stubs.DualInlineControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineControlPoint toInlineControlPoint() {\r
- return new org.simantics.processeditor.stubs.InlineControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getRotationAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setRotationAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasRotationAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class Straight extends Entity implements IStraight {\r
- \r
- public Straight(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public Straight(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static Straight createDefault(Graph graph) {\r
- return new Straight(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Straight));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Straight;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.CodedComponent toCodedComponent() {\r
- return new org.simantics.processeditor.stubs.CodedComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineComponent toInlineComponent() {\r
- return new org.simantics.processeditor.stubs.InlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.DualConnectedComponent toDualConnectedComponent() {\r
- return new org.simantics.processeditor.stubs.DualConnectedComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.VariableLengthInlineComponent toVariableLengthInlineComponent() {\r
- return new org.simantics.processeditor.stubs.VariableLengthInlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Straight toStraight() {\r
- return this;\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class TurnComponent extends Entity implements ITurnComponent {\r
- \r
- public TurnComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public TurnComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static TurnComponent createDefault(Graph graph) {\r
- return new TurnComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).TurnComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).TurnComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public TurnComponent toTurnComponent() {\r
- return this;\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getTurnAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setTurnAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class TurnControlPoint extends Entity implements ITurnControlPoint {\r
- \r
- public TurnControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public TurnControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static TurnControlPoint createDefault(Graph graph) {\r
- return new TurnControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).TurnControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).TurnControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PathLegEndControlPoint toPathLegEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.PathLegEndControlPoint(graph, resource);\r
- }\r
- \r
- public TurnControlPoint toTurnControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getTurnAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setTurnAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class UndirectedControlPoint extends Entity implements IUndirectedControlPoint {\r
- \r
- public UndirectedControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public UndirectedControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static UndirectedControlPoint createDefault(Graph graph) {\r
- return new UndirectedControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).UndirectedControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).UndirectedControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PathLegEndControlPoint toPathLegEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.PathLegEndControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.RunEndControlPoint toRunEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.RunEndControlPoint(graph, resource);\r
- }\r
- \r
- public UndirectedControlPoint toUndirectedControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class VariableAngleTurnComponent extends Entity implements IVariableAngleTurnComponent {\r
- \r
- public VariableAngleTurnComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public VariableAngleTurnComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static VariableAngleTurnComponent createDefault(Graph graph) {\r
- return new VariableAngleTurnComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).VariableAngleTurnComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).VariableAngleTurnComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public VariableAngleTurnComponent toVariableAngleTurnComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.TurnComponent toTurnComponent() {\r
- return new org.simantics.processeditor.stubs.TurnComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getTurnRadius() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnRadius);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setTurnRadius(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnRadius;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getTurnAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setTurnAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class VariableAngleTurnControlPoint extends Entity implements IVariableAngleTurnControlPoint {\r
- \r
- public VariableAngleTurnControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public VariableAngleTurnControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static VariableAngleTurnControlPoint createDefault(Graph graph) {\r
- return new VariableAngleTurnControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).VariableAngleTurnControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).VariableAngleTurnControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PathLegEndControlPoint toPathLegEndControlPoint() {\r
- return new org.simantics.processeditor.stubs.PathLegEndControlPoint(graph, resource);\r
- }\r
- \r
- public VariableAngleTurnControlPoint toVariableAngleTurnControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.TurnControlPoint toTurnControlPoint() {\r
- return new org.simantics.processeditor.stubs.TurnControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getTurnRadius() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnRadius);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setTurnRadius(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnRadius;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getTurnAngle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setTurnAngle(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAngle;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Tuple3 getTurnAxis() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAxis);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Tuple3(graph, statements[0].getObject());\r
- }\r
- \r
- public void addTurnAxis(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAxis, v.getResource());\r
- }\r
- \r
- public void setTurnAxis(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasTurnAxis;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class VariableLengthControlPoint extends Entity implements IVariableLengthControlPoint {\r
- \r
- public VariableLengthControlPoint(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public VariableLengthControlPoint(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static VariableLengthControlPoint createDefault(Graph graph) {\r
- return new VariableLengthControlPoint(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).VariableLengthControlPoint));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).VariableLengthControlPoint;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public VariableLengthControlPoint toVariableLengthControlPoint() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineControlPoint toInlineControlPoint() {\r
- return new org.simantics.processeditor.stubs.InlineControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint toPipeControlPoint() {\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, resource);\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getNext() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNext(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext, v.getResource());\r
- }\r
- \r
- public void setNext(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNext;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getPrevious() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addPrevious(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious, v.getResource());\r
- }\r
- \r
- public void setPrevious(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPrevious;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PipeControlPoint> getSubPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint);\r
- Collection<org.simantics.processeditor.stubs.PipeControlPoint> ret = new ArrayList<org.simantics.processeditor.stubs.PipeControlPoint>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PipeControlPoint(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addSubPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasSubPoint, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getSubPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addSubPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf, v.getResource());\r
- }\r
- \r
- public void setSubPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).SubPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public org.simantics.layer0.utils.IEntity getControlPointOf() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new Entity(graph, statements[0].getObject());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void addControlPointOf(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf, v.getResource());\r
- }\r
- \r
- // [Nozzle] | [Pipeline Component]\r
- public void setControlPointOf(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOf;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeRun getControlPointOfPipeRun() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeRun(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPointOfPipeRun(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun, v.getResource());\r
- }\r
- \r
- public void setControlPointOfPipeRun(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).ControlPointOfPipeRun;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class VariableLengthInlineComponent extends Entity implements IVariableLengthInlineComponent {\r
- \r
- public VariableLengthInlineComponent(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public VariableLengthInlineComponent(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static VariableLengthInlineComponent createDefault(Graph graph) {\r
- return new VariableLengthInlineComponent(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).VariableLengthInlineComponent));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).VariableLengthInlineComponent;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.InlineComponent toInlineComponent() {\r
- return new org.simantics.processeditor.stubs.InlineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public VariableLengthInlineComponent toVariableLengthInlineComponent() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipelineComponent toPipelineComponent() {\r
- return new org.simantics.processeditor.stubs.PipelineComponent(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public double[] getPipeDiameter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setPipeDiameter(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasPipeDiameter;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getLength() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setLength(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasLength;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PipeControlPoint getControlPoint() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PipeControlPoint(graph, statements[0].getObject());\r
- }\r
- \r
- public void addControlPoint(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint, v.getResource());\r
- }\r
- \r
- public void setControlPoint(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasControlPoint;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class VerticalVessel extends Entity implements IVerticalVessel {\r
- \r
- public VerticalVessel(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public VerticalVessel(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static VerticalVessel createDefault(Graph graph) {\r
- return new VerticalVessel(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).VerticalVessel));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).VerticalVessel;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public VerticalVessel toVerticalVessel() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.Vessel toVessel() {\r
- return new org.simantics.processeditor.stubs.Vessel(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.Equipment toEquipment() {\r
- return new org.simantics.processeditor.stubs.Equipment(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.Nozzle getNozzle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.Nozzle(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNozzle(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle, v.getResource());\r
- }\r
- \r
- public void setNozzle(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle]&[Property]\r
- public Collection<org.simantics.layer0.utils.IEntity> getNozzleDefinition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleDefinition);\r
- Collection<org.simantics.layer0.utils.IEntity> ret = new ArrayList<org.simantics.layer0.utils.IEntity>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new Entity(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- // [Nozzle]&[Property]\r
- public void addNozzleDefinition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleDefinition, v.getResource());\r
- }\r
- \r
- public String[] getNozzleRestriction() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleRestriction);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return (String[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setNozzleRestriction(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleRestriction;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).IntegerRangeUnion;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
- public double[] getHeight() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasHeight);\r
- if(statements.length != 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- return (double[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setHeight(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasHeight;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).Double;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.processeditor.stubs;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.ResourceContainer;\r
-import org.simantics.layer0.utils.ResourceDoesNotSatisfyAssumptionException;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import java.util.Collection;\r
-import java.util.ArrayList;\r
-\r
-public class Vessel extends Entity implements IVessel {\r
- \r
- public Vessel(Graph graph, ResourceContainer resourceContainer) {\r
- super(graph, resourceContainer.getResource());\r
- }\r
- \r
- public Vessel(IEntity entity) {\r
- super(entity.getGraph(), entity.getResource());\r
- }\r
- \r
- public Graph getGraph() {\r
- return graph;\r
- }\r
- \r
- public static Vessel createDefault(Graph graph) {\r
- return new Vessel(graph, InstanceFactory.instantiate(graph, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Vessel));\r
- }\r
- \r
- public static boolean isInstance(IEntity entity) {\r
- Graph graph = entity.getGraph();\r
- Resource type = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).Vessel;\r
- return graph.isInstanceOf(entity.getResource(), type);\r
- }\r
- \r
- @Override\r
- public Resource getResource() {\r
- return resource;\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode toG3DNode() {\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode toPBSNode() {\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.P3DNode toP3DNode() {\r
- return new org.simantics.processeditor.stubs.P3DNode(graph, resource);\r
- }\r
- \r
- public Vessel toVessel() {\r
- return this;\r
- }\r
- \r
- public org.simantics.processeditor.stubs.Equipment toEquipment() {\r
- return new org.simantics.processeditor.stubs.Equipment(graph, resource);\r
- }\r
- \r
- public org.simantics.processeditor.stubs.LibraryComponent toLibraryComponent() {\r
- return new org.simantics.processeditor.stubs.LibraryComponent(graph, resource);\r
- }\r
- \r
- public Collection<org.simantics.proconf.g3d.stubs.G3DNode> getChild() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild);\r
- Collection<org.simantics.proconf.g3d.stubs.G3DNode> ret = new ArrayList<org.simantics.proconf.g3d.stubs.G3DNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.proconf.g3d.stubs.G3DNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChild(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasChild, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DNode getParent() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParent(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent, v.getResource());\r
- }\r
- \r
- public void setParent(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasParent;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getLocalPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition, v.getResource());\r
- }\r
- \r
- public void setLocalPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Position getWorldPosition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Position(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldPosition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition, v.getResource());\r
- }\r
- \r
- public void setWorldPosition(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldPosition;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getLocalOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addLocalOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation, v.getResource());\r
- }\r
- \r
- public void setLocalOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasLocalOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Orientation getWorldOrientation() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Orientation(graph, statements[0].getObject());\r
- }\r
- \r
- public void addWorldOrientation(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation, v.getResource());\r
- }\r
- \r
- public void setWorldOrientation(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasWorldOrientation;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.Center getCenter() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.Center(graph, statements[0].getObject());\r
- }\r
- \r
- public void addCenter(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter, v.getResource());\r
- }\r
- \r
- public void setCenter(ResourceContainer v) {\r
- Resource predicate = org.simantics.proconf.g3d.stubs.G3DResource.getInstance(graph).HasCenter;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.PBSNode getParentStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.PBSNode(graph, statements[0].getObject());\r
- }\r
- \r
- public void addParentStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure, v.getResource());\r
- }\r
- \r
- public void setParentStructure(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasParentStructure;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public Collection<org.simantics.processeditor.stubs.PBSNode> getChildStructure() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure);\r
- Collection<org.simantics.processeditor.stubs.PBSNode> ret = new ArrayList<org.simantics.processeditor.stubs.PBSNode>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new org.simantics.processeditor.stubs.PBSNode(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- public void addChildStructure(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasChildStructure, v.getResource());\r
- }\r
- \r
- public org.simantics.proconf.g3d.stubs.G3DModel getGraphics() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.proconf.g3d.stubs.G3DModel(graph, statements[0].getObject());\r
- }\r
- \r
- public void addGraphics(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics, v.getResource());\r
- }\r
- \r
- public void setGraphics(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasGraphics;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- public org.simantics.processeditor.stubs.Nozzle getNozzle() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return new org.simantics.processeditor.stubs.Nozzle(graph, statements[0].getObject());\r
- }\r
- \r
- public void addNozzle(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle, v.getResource());\r
- }\r
- \r
- public void setNozzle(ResourceContainer v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzle;\r
- graph.removeStatements(resource, predicate);\r
- graph.addStatement(resource, predicate, v.getResource());\r
- }\r
- \r
- // [Nozzle]&[Property]\r
- public Collection<org.simantics.layer0.utils.IEntity> getNozzleDefinition() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleDefinition);\r
- Collection<org.simantics.layer0.utils.IEntity> ret = new ArrayList<org.simantics.layer0.utils.IEntity>(statements.length);\r
- for(Statement s : statements)\r
- ret.add(new Entity(graph, s.getObject()));\r
- return ret;\r
- }\r
- \r
- // [Nozzle]&[Property]\r
- public void addNozzleDefinition(ResourceContainer v) {\r
- graph.addStatement(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleDefinition, v.getResource());\r
- }\r
- \r
- public String[] getNozzleRestriction() {\r
- Statement[] statements = graph.getStatements(resource, org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleRestriction);\r
- if(statements.length > 1)\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + statements.length + ") of statements.");\r
- if(statements.length == 0)\r
- return null;\r
- return (String[])graph.getValueAsObject(statements[0].getObject());\r
- }\r
- \r
- public void setNozzleRestriction(Object v) {\r
- Resource predicate = org.simantics.processeditor.stubs.Plant3DResource.getInstance(graph).HasNozzleRestriction;\r
- Collection<Resource> objects = graph.getObjects(resource, predicate);\r
- if(objects.size() == 0) {\r
- Resource r = graph.newResource();\r
- Resource valueType = org.simantics.db.Builtins.getInstance(graph).IntegerRangeUnion;\r
- graph.addStatement(r, graph.getBuiltins().InstanceOf, valueType);\r
- graph.setValueAsObject(r, v);\r
- graph.addStatement(resource, predicate, r);\r
- }\r
- else if(objects.size() == 1)\r
- for(Resource r : objects)\r
- graph.setValueAsObject(r, v);\r
- else\r
- throw new ResourceDoesNotSatisfyAssumptionException("Wrong number (" + objects.size() + ") of statements.");\r
- }\r
- \r
-}\r
-\r