X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.mapping%2Fsrc%2Forg%2Fsimantics%2Fmapping%2Frule%2FAndRule.java;h=10854bb3ff9d35fcd3d245be9d382f9c4d4d035f;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=2ac4ed41a08891681520947928556e696edcf1c6;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.mapping/src/org/simantics/mapping/rule/AndRule.java b/bundles/org.simantics.mapping/src/org/simantics/mapping/rule/AndRule.java index 2ac4ed41a..10854bb3f 100644 --- a/bundles/org.simantics.mapping/src/org/simantics/mapping/rule/AndRule.java +++ b/bundles/org.simantics.mapping/src/org/simantics/mapping/rule/AndRule.java @@ -1,47 +1,47 @@ -/******************************************************************************* - * 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; - -import gnu.trove.map.hash.TObjectIntHashMap; - -import org.simantics.db.Resource; -import org.simantics.mapping.constraint.TooManyUnboundVariablesException; -import org.simantics.mapping.rule.instructions.AndRuleInstruction; -import org.simantics.mapping.rule.instructions.IRuleInstruction; -import org.simantics.utils.datastructures.persistent.ImmutableSet; - -public class AndRule implements IRule { - - IRule[] rules; - - public AndRule(IRule ... rules) { - this.rules = rules; - } - - @Override - public ImmutableSet binds() { - ImmutableSet ret = ImmutableSet.empty(); - for(IRule rule : rules) - ret = ret.addAll(rule.binds()); - return ret; - } - - @Override - public IRuleInstruction createInstruction( - TObjectIntHashMap variableIds, ImmutableSet bound) throws TooManyUnboundVariablesException { - IRuleInstruction[] instructions = new IRuleInstruction[rules.length]; - for(int i=0;i binds() { + ImmutableSet ret = ImmutableSet.empty(); + for(IRule rule : rules) + ret = ret.addAll(rule.binds()); + return ret; + } + + @Override + public IRuleInstruction createInstruction( + TObjectIntHashMap variableIds, ImmutableSet bound) throws TooManyUnboundVariablesException { + IRuleInstruction[] instructions = new IRuleInstruction[rules.length]; + for(int i=0;i