Clover coverage report - Maven Clover report
Coverage timestamp: Tue Sep 16 2008 01:16:37 EEST
file stats: LOC: 106   Methods: 6
NCLOC: 40   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
UnaryImpl.java 0% 0% 0% 0%
coverage
 1    /*
 2    wsmo4j - a WSMO API and Reference Implementation
 3    Copyright (c) 2004, University of Innsbruck, Institute of Computer Science
 4    This library is free software; you can redistribute it and/or modify it under
 5    the terms of the GNU Lesser General Public License as published by the Free
 6    Software Foundation; either version 2.1 of the License, or (at your option)
 7    any later version.
 8    This library is distributed in the hope that it will be useful, but WITHOUT
 9    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 10    FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 11    details.
 12    You should have received a copy of the GNU Lesser General Public License along
 13    with this library; if not, write to the Free Software Foundation, Inc.,
 14    59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 15    */
 16    package org.deri.wsmo4j.logicalexpression;
 17   
 18   
 19    import java.util.List;
 20    import java.util.Vector;
 21   
 22    import org.deri.wsmo4j.logicalexpression.util.ExpressionContainmentUtil;
 23    import org.omwg.logicalexpression.*;
 24   
 25   
 26    /**
 27    * This class reunites all unary logical expressions (e.g op LogExpr)
 28    *
 29    * @author DERI Innsbruck, reto.krummenacher@deri.org
 30    * @author DERI Innsbruck, thomas.haselwanter@deri.org
 31    * @version $Revision: 1946 $ $Date: 2007-04-02 15:13:28 +0300 (Mon, 02 Apr 2007) $
 32    * @see org.omwg.logicalexpression.Unary
 33    */
 34    public abstract class UnaryImpl extends LogicalExpressionImpl
 35    implements Unary {
 36   
 37    protected LogicalExpression expr;
 38   
 39    /**
 40    * @param expr the logical expression
 41    * @throws in case the logical expression contains a nested CONSTRAINT
 42    */
 43  0 public UnaryImpl(LogicalExpression expr)
 44    throws IllegalArgumentException {
 45  0 setOperand(expr);
 46    }
 47   
 48    /**
 49    * @see CompoundExpression#listOperands()
 50    */
 51  0 public List <LogicalExpression> listOperands() {
 52  0 Vector <LogicalExpression> ret = new Vector <LogicalExpression> ();
 53  0 ret.add(expr);
 54  0 return ret;
 55    }
 56   
 57  0 public LogicalExpression getOperand() {
 58  0 return expr;
 59    }
 60   
 61    public abstract void accept(Visitor v);
 62   
 63    /**
 64    * <p>
 65    * If two objects are equal according to the <code>equals(Object)</code> method, then calling
 66    * the <code>hashCode</code> method on each of the two objects must produce the same integer
 67    * result. However, it is not required that if two objects are unequal according to
 68    * the <code>equals(Object)</code> method, then calling the <code>hashCode</code> method on each of the two
 69    * objects must produce distinct integer results.
 70    * </p>
 71    * <p>
 72    * This method should be overriden, when the <code>equals(Object)</code> method is overriden.
 73    * </p>
 74    * @return A hash code value for this Object.
 75    * @see java.lang.Object#hashCode()
 76    * @see java.lang.Object#equals(Object)
 77    * @see com.ontotext.wsmo4j.ontology.LogicalExpressionImpl#hashCode()
 78    */
 79  0 public int hashCode() {
 80  0 return expr.hashCode();
 81    }
 82   
 83    /* (non-Javadoc)
 84    * @see org.omwg.logicalexpression.Unary#setOperand(org.omwg.logicalexpression.LogicalExpression)
 85    */
 86  0 public void setOperand(LogicalExpression le) throws IllegalArgumentException {
 87  0 if (ExpressionContainmentUtil.contains(le, Constraint.class)) {
 88  0 throw new IllegalArgumentException(
 89    "Unary Expression may not contain a nested CONSTRAINT");
 90    }
 91  0 expr = le;
 92    }
 93   
 94    /* (non-Javadoc)
 95    * @see org.omwg.logicalexpression.CompoundExpression#setOperands(java.util.List)
 96    */
 97  0 public void setOperands(List operands) {
 98  0 if (operands.size()>1){
 99  0 throw new IllegalArgumentException("Unaries only take one argument!");
 100    }
 101  0 if (! (operands instanceof LogicalExpression)){
 102  0 throw new IllegalArgumentException("Operand of unary must be of type LogicalExpression");
 103    }
 104  0 setOperand((LogicalExpression)operands.get(0));
 105    }
 106    }