Coverage Report - org.deri.wsmo4j.choreography.rule.IfThenRI
 
Classes in this File Line Coverage Branch Coverage Complexity
IfThenRI
0%
0/15
N/A
0
 
 1  
 /*
 2  
  wsmo4j extension - a Choreography 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.choreography.rule;
 20  
 
 21  
 import java.util.Set;
 22  
 
 23  
 import org.deri.wsmo4j.io.serializer.wsml.*;
 24  
 import org.wsmo.common.*;
 25  
 import org.wsmo.service.choreography.rule.ChoreographyIfThen;
 26  
 import org.wsmo.service.rule.*;
 27  
 
 28  
 /**
 29  
  * Reference Implementation for the IfThen rule.
 30  
  * 
 31  
  * <pre>
 32  
  *     Created on Jul 26, 2005
 33  
  *     Committed by $Author: vassil_momtchev $
 34  
  *     $Source$
 35  
  * </pre>
 36  
  * 
 37  
  * @author Thomas Haselwanter
 38  
  * @author James Scicluna
 39  
  * 
 40  
  * @version $Revision: 1844 $ $Date: 2006-10-24 17:11:48 +0300 (Tue, 24 Oct 2006) $
 41  
  */
 42  
 public class IfThenRI extends AbstractTransitionRuleRI implements ChoreographyIfThen {
 43  
 
 44  
     /**
 45  
      * @param condition
 46  
      *            LogicalExpression object defining the condition of the rule.
 47  
      * @param rule
 48  
      *            An inner Rule object of the rule
 49  
      */
 50  0
     public IfThenRI(Condition condition, ChoreographyRule rule) {
 51  0
         this.setCondition(condition);
 52  0
         rules.clear();
 53  0
         rules.add(rule);
 54  0
     }
 55  
 
 56  
     /**
 57  
      * @param condition
 58  
      *            LogicalExpression object defining the condition of the rule.
 59  
      * @param rules
 60  
      *            A set of inner Rule objects of the rule
 61  
      */
 62  0
     public IfThenRI(Condition condition, Set<ChoreographyRule> rules) {
 63  0
         this.setCondition(condition);
 64  0
         this.setRules(rules);
 65  0
     }
 66  
 
 67  
     /*
 68  
      * (non-Javadoc)
 69  
      * 
 70  
      * @see org.wsmo.service.choreography.rule.Rule#accept(org.wsmo.service.choreography.rule.Visitor)
 71  
      */
 72  
     public void accept(Visitor visitor) {
 73  0
         visitor.visitChoreographyIfThen(this);
 74  0
     }
 75  
 
 76  
     /* (non-Javadoc)
 77  
      * @see org.wsmo.service.choreography.rule.Rule#toString(org.wsmo.common.TopEntity)
 78  
      */
 79  
     public String toString(TopEntity te) {
 80  0
         VisitorSerializeWSMLTransitionRules visitor = new VisitorSerializeWSMLTransitionRules(te);
 81  0
         visitor.visitChoreographyIfThen(this);
 82  0
         return visitor.getSerializedObject();
 83  
     }
 84  
     
 85  
     @Override
 86  
     public String toString() {
 87  0
         return toString(null);
 88  
     }
 89  
 }