/******************************************************************************* * 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