Clover coverage report - Maven Clover report
Coverage timestamp: Tue Sep 16 2008 01:16:37 EEST
file stats: LOC: 118   Methods: 5
NCLOC: 49   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LogicalExpressionErrorImpl.java 0% 0% 0% 0%
coverage
 1    /*
 2    wsmo4j - a WSMO API and Reference Implementation
 3    Copyright (c) 2005, University of Innsbruck, Austria
 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.validator;
 17   
 18    import org.omwg.logicalexpression.LogicalExpression;
 19    import org.wsmo.common.*;
 20    import org.wsmo.validator.LogicalExpressionError;
 21   
 22    public class LogicalExpressionErrorImpl extends ValidationErrorImpl implements LogicalExpressionError {
 23   
 24    private LogicalExpression logicalexpression = null;
 25   
 26    private Entity entity = null;
 27   
 28    private String reason = null;
 29   
 30   
 31  0 public LogicalExpressionErrorImpl(Entity entity, LogicalExpression logexp, String reason, String variant) {
 32  0 super(entity, reason, variant);
 33  0 this.entity = entity;
 34  0 this.reason = reason;
 35  0 this.logicalexpression = logexp;
 36    }
 37   
 38    /**
 39    * @see org.wsmo.validator.LogicalExpressionError#getLogExp()
 40    * @return logical expression in which the violation occured
 41    */
 42  0 public LogicalExpression getLogExp() {
 43  0 return logicalexpression;
 44    }
 45   
 46    /**
 47    * Formats the String representation of the ValidationError.
 48    *
 49    * @see java.lang.Object#toString()
 50    */
 51  0 public String toString() {
 52  0 String id = "<Identifier>";
 53    //short id if possible:
 54  0 if (getEntity() != null) {
 55  0 id = getEntity().getIdentifier().toString();
 56  0 if (getEntity().getIdentifier()instanceof IRI) {
 57  0 id = ((IRI)getEntity().getIdentifier()).getLocalName();
 58    }
 59    }
 60    //short for variant if possible
 61  0 String shortVariant = getViolatesVariant();
 62  0 if (getViolatesVariant().lastIndexOf('/') != -1) {
 63  0 shortVariant =getViolatesVariant().substring(getViolatesVariant().lastIndexOf('/') + 1);
 64    }
 65  0 return id + "\n" + getReason() +
 66    "\n(violated variant: " + shortVariant + ")";
 67    }
 68   
 69    /**
 70    * <p>
 71    * The <code>equals</code> method implements an equivalence relation
 72    * on non-null object references. ValidationWarnings are equal if their
 73    * warning and quickFix messages are equal.
 74    * </p>
 75    * <p>
 76    * It is generally necessary to override the <code>hashCode</code> method whenever this method
 77    * is overridden.
 78    * </p>
 79    * @param o the reference object with which to compare.
 80    * @return <code>true</code> if this object is the same as the obj
 81    * argument; <code>false</code> otherwise.
 82    * @see java.lang.Object#equals(java.lang.Object)
 83    * @see java.lang.Object#hashCode()
 84    */
 85  0 public boolean equals(Object obj) {
 86  0 if (obj instanceof LogicalExpressionError) {
 87  0 LogicalExpressionErrorImpl lee = (LogicalExpressionErrorImpl) obj;
 88  0 if (entity == null) {
 89  0 return super.equals(obj);
 90    }
 91    else {
 92  0 return (lee.getReason().equals(reason)
 93    && lee.getEntity().equals(entity));
 94    }
 95    }
 96  0 return false;
 97    }
 98   
 99    /**
 100    * <p>
 101    * If two objects are equal according to the <code>equals(Object)</code> method, then calling
 102    * the <code>hashCode</code> method on each of the two objects must produce the same integer
 103    * result. However, it is not required that if two objects are unequal according to
 104    * the <code>equals(Object)</code> method, then calling the <code>hashCode</code> method on each of the two
 105    * objects must produce distinct integer results.
 106    * </p>
 107    * <p>
 108    * This method should be overriden, when the <code>equals(Object)</code> method is overriden.
 109    * </p>
 110    * @return A hash code value for this Object.
 111    * @see java.lang.Object#hashCode()
 112    * @see java.lang.Object#equals(Object)
 113    */
 114  0 public int hashCode() {
 115  0 return super.hashCode();
 116    }
 117   
 118    }