]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge remote-tracking branch 'origin/master' into private/antti2 private/antti2
authorAntti Villberg <antti.villberg@semantum.fi>
Sat, 11 Jan 2020 10:54:22 +0000 (12:54 +0200)
committerAntti Villberg <antti.villberg@semantum.fi>
Sat, 11 Jan 2020 10:54:22 +0000 (12:54 +0200)
Conflicts:
bundles/org.simantics.acorn/src/org/simantics/acorn/OperationQueue.java
bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PropertyInfo.java
bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardVariableBuilder.java

Change-Id: I5a4cbd88743669fa4b1104ec466c0efa3aa0aa3d

bundles/org.simantics.acorn/src/org/simantics/acorn/OperationQueue.java
bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PropertyInfo.java
bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardVariableBuilder.java

index c5cf5f7bf1d31be3502473bd0e1a82aa7a5c8c09..d48f9ba6da792f6c292f1ac4ac14cf01aaadbd95 100644 (file)
@@ -159,21 +159,18 @@ class OperationQueue {
         */
        synchronized long waitFor() {
 
-           mainProgram.assertMainProgramThread();
-
-           // One last check within the monitor 
-           if(!operations.isEmpty() || !tasks.isEmpty()) return 0;
+               mainProgram.assertMainProgramThread();
 
-           long start = System.nanoTime();
+               // One last check within the monitor 
+               if(!operations.isEmpty() || !tasks.isEmpty()) return 0;
 
-           try {
-               wait(5000);
-           } catch (InterruptedException e) {
-               LOGGER.error("Unexpected interruption", e);
-           }
-           
-           return System.nanoTime() - start;
+               long start = System.nanoTime();
+               try {
+                       wait(5000);
+               } catch (InterruptedException e) {
+                       LOGGER.error("Unexpected interruption", e);
+               }
+               return System.nanoTime() - start;
 
        }
-
 }
index a7ef69c8bb38f193b142c39d3e47a40998f1010c..286ce09aaea0ad4c18b4ddb4fb52c2e304883197 100644 (file)
@@ -28,83 +28,79 @@ import org.simantics.layer0.Layer0;
 import org.simantics.utils.datastructures.Pair;
 
 public class PropertyInfo {
-       public final Resource predicate;
-       public final String name;
-       public final boolean isImmutable;
-       public final boolean isHasProperty;
-       public final boolean isFunctional;
-       public final Set<String> classifications;
-       public final VariableBuilder builder;
-       public final Resource literalRange;
-       public final Datatype requiredDatatype;
-       public final String requiredValueType;
-       public final String definedUnit;
-       public final Binding defaultBinding;
-       public final Map<String,Pair<Resource, ChildReference>> subliteralPredicates;
-       public final ValueAccessor valueAccessor;
-       public final boolean hasEnumerationRange;
-       public PropertyInfo(Resource predicate, String name, boolean isImmutable, boolean isFunctional, boolean isHasProperty, Set<String> classifications, VariableBuilder builder, Resource literalRange, Datatype requiredDatatype, String definedUnit, String requiredValueType, Binding defaultBinding, Map<String,Pair<Resource, ChildReference>> subliteralPredicates, ValueAccessor valueAccessor, boolean hasEnumerationRange) {
-               this.predicate = predicate;
-               this.name = name;
-               this.isImmutable = isImmutable;
-               this.isFunctional = isFunctional;
-               this.isHasProperty = isHasProperty;
-               this.classifications = classifications;
-               this.builder = builder;
-               this.literalRange = literalRange;
-               this.requiredDatatype = requiredDatatype;
-               this.definedUnit = definedUnit;
-               this.requiredValueType = requiredValueType;
-               this.defaultBinding = defaultBinding;
-               this.subliteralPredicates = subliteralPredicates;
-               this.valueAccessor = valueAccessor;
-               this.hasEnumerationRange = hasEnumerationRange;
-       }
-       public static PropertyInfo make(ReadGraph graph, Resource predicate, String name, boolean isFunctional, boolean isHasProperty, Set<String> classifications, VariableBuilder builder, Resource literalRange, Datatype requiredDatatype, String definedUnit, String requiredValueType, Map<String,Pair<Resource, ChildReference>> subliteralPredicates, ValueAccessor valueAccessor, boolean hasEnumerationRange) throws DatabaseException {
-
-               Layer0 L0 = Layer0.getInstance(graph);
-               if(literalRange != null) {
-                       Collection<Resource> dts = graph.getAssertedObjects(literalRange, L0.HasDataType);
-                       if(dts.size() == 1) {
-                               Datatype dt = graph.getPossibleValue(dts.iterator().next(), Bindings.DATATYPE);
-                               if(requiredDatatype == null) requiredDatatype = dt;
-                       }
-               }
-               
-               Binding defaultBinding = requiredDatatype != null ? Bindings.getBinding(requiredDatatype) : null;
-               
-               return new PropertyInfo(predicate, name, graph.isImmutable(predicate), isFunctional, isHasProperty, classifications, builder, literalRange, requiredDatatype, definedUnit, requiredValueType, defaultBinding, subliteralPredicates, valueAccessor, hasEnumerationRange);
-
-       }
-       public boolean hasClassification(String classification) {
-               return classifications.contains(classification);
-       }
-       @Override
-       public String toString() {
-               StringBuilder sb = new StringBuilder();
-               sb.append("PropertyInfo [")
-               .append(name)
-               .append(" : ")
-               .append(requiredDatatype)
-               .append(" :: ")
-               .append(requiredValueType)
-               .append(", predicate=")
-               .append(predicate)
-               .append(", isFunctional=")
-               .append(isFunctional)
-               .append(", isHasProperty=")
-               .append(isHasProperty)
-               .append(", hasEnumerationRange=")
-               .append(hasEnumerationRange)
-               .append(", definedUnit=")
-               .append(definedUnit != null ? definedUnit : "<none>")
-               .append(", defaultBinding=")
-               .append(defaultBinding)
-               .append(", valueAccessor=")
-               .append(valueAccessor)
-               .append("]");
-               return sb.toString();
-       }
+    public final Resource predicate;
+    public final String name;
+    public final boolean isImmutable;
+    public final boolean isHasProperty;
+    public final boolean isFunctional;
+    public final Set<String> classifications;
+    public final VariableBuilder builder;
+    public final Resource literalRange;
+    public final Datatype requiredDatatype;
+    public final String requiredValueType;
+    public final String definedUnit;
+    public final Binding defaultBinding;
+    public final Map<String,Pair<Resource, ChildReference>> subliteralPredicates;
+    public final ValueAccessor valueAccessor;
+    public final boolean hasEnumerationRange;
+    public PropertyInfo(Resource predicate, String name, boolean isImmutable, boolean isFunctional, boolean isHasProperty, Set<String> classifications, VariableBuilder builder, Resource literalRange, Datatype requiredDatatype, String definedUnit, String requiredValueType, Binding defaultBinding, Map<String,Pair<Resource, ChildReference>> subliteralPredicates, ValueAccessor valueAccessor, boolean hasEnumerationRange) {
+        this.predicate = predicate;
+        this.name = name;
+        this.isImmutable = isImmutable;
+        this.isFunctional = isFunctional;
+        this.isHasProperty = isHasProperty;
+        this.classifications = classifications;
+        this.builder = builder;
+        this.literalRange = literalRange;
+        this.requiredDatatype = requiredDatatype;
+        this.definedUnit = definedUnit;
+        this.requiredValueType = requiredValueType;
+        this.defaultBinding = defaultBinding;
+        this.subliteralPredicates = subliteralPredicates;
+        this.valueAccessor = valueAccessor;
+        this.hasEnumerationRange = hasEnumerationRange;
+    }
+    public static PropertyInfo make(ReadGraph graph, Resource predicate, String name, boolean isFunctional, boolean isHasProperty, Set<String> classifications, VariableBuilder builder, Resource literalRange, Datatype requiredDatatype, String definedUnit, String requiredValueType, Map<String,Pair<Resource, ChildReference>> subliteralPredicates, ValueAccessor valueAccessor, boolean hasEnumerationRange) throws DatabaseException {
+        Layer0 L0 = Layer0.getInstance(graph);
+        if(literalRange != null) {
+            Collection<Resource> dts = graph.getAssertedObjects(literalRange, L0.HasDataType);
+            if(dts.size() == 1) {
+                Datatype dt = graph.getPossibleValue(dts.iterator().next(), Bindings.DATATYPE);
+                if(requiredDatatype == null) requiredDatatype = dt;
+            }
+        }
+        Binding defaultBinding = requiredDatatype != null ? Bindings.getBinding(requiredDatatype) : null;
+        return new PropertyInfo(predicate, name, graph.isImmutable(predicate), isFunctional, isHasProperty, classifications, builder, literalRange, requiredDatatype, definedUnit, requiredValueType, defaultBinding, subliteralPredicates, valueAccessor, hasEnumerationRange);
+    }
+    public boolean hasClassification(String classification) {
+        return classifications.contains(classification);
+    }
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("PropertyInfo [")
+        .append(name)
+        .append(" : ")
+        .append(requiredDatatype)
+        .append(" :: ")
+        .append(requiredValueType)
+        .append(", predicate=")
+        .append(predicate)
+        .append(", isFunctional=")
+        .append(isFunctional)
+        .append(", isHasProperty=")
+        .append(isHasProperty)
+        .append(", hasEnumerationRange=")
+        .append(hasEnumerationRange)
+        .append(", definedUnit=")
+        .append(definedUnit != null ? definedUnit : "<none>")
+        .append(", defaultBinding=")
+        .append(defaultBinding)
+        .append(", valueAccessor=")
+        .append(valueAccessor)
+        .append("]");
+        return sb.toString();
+    }
     @Override
     public int hashCode() {
         final int prime = 31;
index 6e83fe139fe77f5dadc3dd069f4bc6e6de56038c..992e3e6990fba165c0fd6c6ca901a479b4521730 100644 (file)
@@ -6,25 +6,25 @@ import org.simantics.db.exception.DatabaseException;
 
 public class StandardVariableBuilder<Node> implements VariableBuilder<Node> {
 
-    private static StandardVariableBuilder INSTANCE = null;
-    
+    private static StandardVariableBuilder<?> INSTANCE = null;
+
     private StandardVariableBuilder() {}
-    
-    public static synchronized StandardVariableBuilder get() {
+
+    public static synchronized StandardVariableBuilder<?> get() {
         if(INSTANCE == null) {
             INSTANCE = new StandardVariableBuilder<>();
         }
         return INSTANCE;
     }
 
-       @Override
-       public Variable buildChild(ReadGraph graph, Variable parent, VariableNode<Node> node, Resource child) {
-               return new StandardGraphChildVariable(parent, node, child);
-       }
+    @Override
+    public Variable buildChild(ReadGraph graph, Variable parent, VariableNode<Node> node, Resource child) {
+        return new StandardGraphChildVariable(parent, node, child);
+    }
 
-       @Override
-       public Variable buildProperty(ReadGraph graph, Variable parent, VariableNode<Node> node, Resource subject, Resource predicate) throws DatabaseException {
-               return new StandardGraphPropertyVariable(graph, parent, node, subject, predicate);
-       }
+    @Override
+    public Variable buildProperty(ReadGraph graph, Variable parent, VariableNode<Node> node, Resource subject, Resource predicate) throws DatabaseException {
+        return new StandardGraphPropertyVariable(graph, parent, node, subject, predicate);
+    }
 
 }