Coverage Report - org.deri.wsmo4j.choreography.signature.GroundedModeRI
 
Classes in this File Line Coverage Branch Coverage Complexity
GroundedModeRI
0%
0/25
0%
0/8
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.signature;
 20  
 
 21  
 import java.util.Collections;
 22  
 import java.util.HashSet;
 23  
 import java.util.Set;
 24  
 
 25  
 import org.omwg.ontology.Concept;
 26  
 import org.omwg.ontology.Relation;
 27  
 import org.wsmo.service.signature.*;
 28  
 
 29  
 /**
 30  
  * Implements the common getGrounding method for the Grounded Modes
 31  
  * 
 32  
  * @author James Scicluna
 33  
  * @author Thomas Haselwanter
 34  
  * 
 35  
  * Created on 26-Sep-2005 Committed by $Author: alex_simov $
 36  
  * 
 37  
  * $Source:
 38  
  * /cvsroot/wsmo4j/ext/choreography/src/ri/org/deri/wsmo4j/choreography/signature/GroundedModeRI.java,v $,
 39  
  * @version $Revision: 1936 $ $Date: 2007-02-22 15:37:46 +0200 (Thu, 22 Feb 2007) $
 40  
  */
 41  
 
 42  
 public abstract class GroundedModeRI extends ModeRI implements GroundedMode {
 43  
 
 44  
     /**
 45  
      * @uml.property   name="groundings"
 46  
      * @uml.associationEnd   multiplicity="(0 -1)" elementType="org.wsmo.service.signature.Grounding"
 47  
      */
 48  
     protected Set<Grounding> groundings;
 49  
 
 50  
     /**
 51  
      * Default constructor
 52  
      * 
 53  
      * @param concept A Concept object with which the Grounded Mode
 54  
      * is initialized
 55  
      */
 56  
     public GroundedModeRI(Concept concept){
 57  0
         super(concept);
 58  0
         this.groundings = new HashSet <Grounding> ();
 59  0
     }
 60  
     
 61  
     /**
 62  
      * @param iri
 63  
      *            An IRI object defining the grounded mode concept/relation
 64  
      * @param g
 65  
      *            A set of Grounding object definitions
 66  
      */
 67  
     public GroundedModeRI(Concept concept, Set<Grounding> g) {
 68  0
         super(concept);
 69  0
         this.groundings = g;
 70  0
         if (g == null) {
 71  0
             this.groundings = new HashSet <Grounding> ();
 72  
         }
 73  
         // TODO Auto-generated constructor stub
 74  0
     }
 75  
     
 76  
     public GroundedModeRI(Relation relation){
 77  0
         super(relation);
 78  0
         this.groundings = new HashSet <Grounding> ();
 79  0
     }
 80  
     
 81  
     public GroundedModeRI(Relation relation, Set <Grounding> g){
 82  0
         super(relation);
 83  0
         this.groundings = g;
 84  0
         if (g == null) {
 85  0
             this.groundings = new HashSet <Grounding> ();
 86  
         }
 87  0
     }
 88  
 
 89  
     /*
 90  
      * (non-Javadoc)
 91  
      * 
 92  
      * @see org.wsmo.service.choreography.signature.GroundedMode#getGrounding()
 93  
      */
 94  
     public Set<Grounding> getGrounding() throws NotGroundedException {
 95  0
         if (this.groundings == null) {
 96  0
             throw new NotGroundedException("Mode is not Grounded");
 97  
         }
 98  0
         else if (this.groundings.size() == 0) {
 99  0
             throw new NotGroundedException("Mode is not Grounded");
 100  
         }
 101  
         else
 102  0
             return Collections.unmodifiableSet(groundings);
 103  
     }
 104  
     
 105  
     /* (non-Javadoc)
 106  
      * @see org.wsmo.service.choreography.signature.GroundedMode#addGrounding(org.wsmo.service.choreography.signature.Grounding)
 107  
      */
 108  
     public void addGrounding(Grounding g){
 109  0
         this.groundings.add(g);
 110  0
     }
 111  
     
 112  
     /* (non-Javadoc)
 113  
      * @see org.wsmo.service.choreography.signature.GroundedMode#removeGrounding(org.wsmo.service.choreography.signature.Grounding)
 114  
      */
 115  
     public void removeGrounding(Grounding g){
 116  0
         this.groundings.remove(g);
 117  0
     }
 118  
 }