| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ChooseRI |
|
| 0.0;0 |
| 1 | /* | |
| 2 | wsmo4j extension - a Orchestration API and Reference Implementation | |
| 3 | ||
| 4 | Copyright (c) 2005, University of Innsbruck, Austria | |
| 5 | ||
| 6 | This library is free software; you can redistribute it and/or modify it under | |
| 7 | the terms of the GNU Lesser General Public License as published by the Free | |
| 8 | Software Foundation; either version 2.1 of the License, or (at your option) | |
| 9 | any later version. | |
| 10 | This library is distributed in the hope that it will be useful, but WITHOUT | |
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 12 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | |
| 13 | details. | |
| 14 | You should have received a copy of the GNU Lesser General Public License along | |
| 15 | with this library; if not, write to the Free Software Foundation, Inc., | |
| 16 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 17 | */ | |
| 18 | ||
| 19 | package org.deri.wsmo4j.orchestration.rule; | |
| 20 | ||
| 21 | import java.util.Set; | |
| 22 | ||
| 23 | import org.deri.wsmo4j.io.serializer.wsml.*; | |
| 24 | import org.omwg.ontology.Variable; | |
| 25 | import org.wsmo.common.*; | |
| 26 | import org.wsmo.service.orchestration.rule.*; | |
| 27 | import org.wsmo.service.rule.*; | |
| 28 | ||
| 29 | /** | |
| 30 | * Reference Implementation for the Choose rule. | |
| 31 | * | |
| 32 | * <pre> | |
| 33 | * Created on Jul 26, 2005 | |
| 34 | * Committed by $Author: vassil_momtchev $ | |
| 35 | * $Source$ | |
| 36 | * </pre> | |
| 37 | * | |
| 38 | * @author Thomas Haselwanter | |
| 39 | * @author James Scicluna | |
| 40 | * | |
| 41 | * @version $Revision: 1851 $ $Date: 2006-10-24 18:01:07 +0300 (Tue, 24 Oct 2006) $ | |
| 42 | */ | |
| 43 | public class ChooseRI extends AbstractQuantifiedRuleRI implements OrchestrationChoose { | |
| 44 | ||
| 45 | /** | |
| 46 | * Constructor for a choose rule. | |
| 47 | * | |
| 48 | * @param variable | |
| 49 | * Quantified variable object. | |
| 50 | * @param condition | |
| 51 | * A LogicalExpression defining the condition of the rule | |
| 52 | * @param rule | |
| 53 | * Inner Rule of choose | |
| 54 | */ | |
| 55 | public ChooseRI(Variable variable, Condition condition, Rule rule) { | |
| 56 | 0 | this(makeSet(variable), condition, makeSet(rule)); |
| 57 | 0 | } |
| 58 | ||
| 59 | /** | |
| 60 | * Constructor for a choose rule | |
| 61 | * | |
| 62 | * @param variables | |
| 63 | * A set of quantified Variable objects | |
| 64 | * @param condition | |
| 65 | * A LogicalExpression defining the condition of the rule | |
| 66 | * @param rule | |
| 67 | * Inner Rule of choose | |
| 68 | */ | |
| 69 | public ChooseRI(Set<Variable> variables, Condition condition, Rule rule) { | |
| 70 | 0 | this(variables, condition, makeSet(rule)); |
| 71 | 0 | } |
| 72 | ||
| 73 | /** | |
| 74 | * Constructor for a choose rule. | |
| 75 | * | |
| 76 | * @param variable | |
| 77 | * Quantified variable object. | |
| 78 | * @param condition | |
| 79 | * A LogicalExpression defining the condition of the rule | |
| 80 | * @param rules | |
| 81 | * A set of inner Rule objects | |
| 82 | */ | |
| 83 | public ChooseRI(Variable variable, Condition condition, Set<Rule> rules) { | |
| 84 | 0 | this(makeSet(variable), condition, rules); |
| 85 | 0 | } |
| 86 | ||
| 87 | /** | |
| 88 | * Constructor for a choose rule | |
| 89 | * | |
| 90 | * @param variables | |
| 91 | * A set of quantified Variable objects | |
| 92 | * @param condition | |
| 93 | * A LogicalExpression defining the condition of the rule | |
| 94 | * @param rules | |
| 95 | * A set of inner Rule objects | |
| 96 | */ | |
| 97 | public ChooseRI(Set<Variable> variables, Condition condition, Set<Rule> rules) { | |
| 98 | 0 | super(variables, condition, rules); |
| 99 | 0 | } |
| 100 | ||
| 101 | /* | |
| 102 | * (non-Javadoc) | |
| 103 | * | |
| 104 | * @see org.wsmo.service.orchestration.rule.Rule#accept(org.wsmo.service.orchestration.rule.Visitor) | |
| 105 | */ | |
| 106 | public void accept(Visitor visitor) { | |
| 107 | 0 | visitor.visitOrchestrationChoose(this); |
| 108 | 0 | } |
| 109 | ||
| 110 | /* (non-Javadoc) | |
| 111 | * @see org.wsmo.service.orchestration.rule.Rule#toString(org.wsmo.common.TopEntity) | |
| 112 | */ | |
| 113 | public String toString(TopEntity te) { | |
| 114 | 0 | VisitorSerializeWSMLTransitionRules visitor = new VisitorSerializeWSMLTransitionRules(te); |
| 115 | 0 | visitor.visitOrchestrationChoose(this); |
| 116 | 0 | return visitor.getSerializedObject(); |
| 117 | } | |
| 118 | ||
| 119 | @Override | |
| 120 | public String toString() { | |
| 121 | 0 | return toString(null); |
| 122 | } | |
| 123 | } |