X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.mapping%2Fsrc%2Forg%2Fsimantics%2Fmapping%2Frule%2Finstructions%2FQueryRuleInstruction.java;h=404df9c4871f625999c74858142d91835da56895;hp=f2407bf15997816e30564fcc189ce58ee480791b;hb=1dfeb7d5c49b1391cd9d877e1eddab18995cb151;hpb=969bd23cab98a79ca9101af33334000879fb60c5 diff --git a/bundles/org.simantics.mapping/src/org/simantics/mapping/rule/instructions/QueryRuleInstruction.java b/bundles/org.simantics.mapping/src/org/simantics/mapping/rule/instructions/QueryRuleInstruction.java index f2407bf15..404df9c48 100644 --- a/bundles/org.simantics.mapping/src/org/simantics/mapping/rule/instructions/QueryRuleInstruction.java +++ b/bundles/org.simantics.mapping/src/org/simantics/mapping/rule/instructions/QueryRuleInstruction.java @@ -1,147 +1,150 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.mapping.rule.instructions; - -import gnu.trove.map.hash.TIntIntHashMap; -import gnu.trove.procedure.TIntProcedure; -import gnu.trove.set.hash.TIntHashSet; - -import org.simantics.db.ReadGraph; -import org.simantics.db.WriteGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.request.Read; -import org.simantics.layer0.utils.triggers.IModification; - -public class QueryRuleInstruction implements IRuleInstruction { - - IRuleInstruction rule; - int[] variables; - int workSpace; - - public QueryRuleInstruction(IRuleInstruction rule) { - this.rule = rule; - TIntHashSet reads = new TIntHashSet(); - TIntHashSet writes = new TIntHashSet(); - rule.collectVariables(reads, writes); - reads.removeAll(writes.toArray()); - variables = reads.toArray(); - final TIntIntHashMap map = new TIntIntHashMap(); - for(int i = 0;i { - - Object[] parameters; - - public Query(Object[] parameters) { - this.parameters = parameters; - } - - QueryRuleInstruction parent() { - return QueryRuleInstruction.this; - } - - @Override - public boolean equals(Object other) { - if(this == other) - return true; - if(other == null || other.getClass() != this.getClass()) - return false; - Query q = (Query)other; - if(!parent().equals(q.parent())) - return false; - if(parameters.length != q.parameters.length) - return false; - for(int i=0;i" + i); - b.append('\n'); - for(int i=0;i { + + Object[] parameters; + + public Query(Object[] parameters) { + this.parameters = parameters; + } + + QueryRuleInstruction parent() { + return QueryRuleInstruction.this; + } + + @Override + public boolean equals(Object other) { + if(this == other) + return true; + if(other == null || other.getClass() != this.getClass()) + return false; + Query q = (Query)other; + if(!parent().equals(q.parent())) + return false; + if(parameters.length != q.parameters.length) + return false; + for(int i=0;i" + i); + b.append('\n'); + for(int i=0;i