001 /** 002 * www.jcoverage.com 003 * Copyright (C)2003 jcoverage ltd. 004 * 005 * This file is part of jcoverage. 006 * 007 * jcoverage is free software; you can redistribute it and/or modify 008 * it under the terms of the GNU General Public License as published 009 * by the Free Software Foundation; either version 2 of the License, 010 * or (at your option) any later version. 011 * 012 * jcoverage is distributed in the hope that it will be useful, but 013 * WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * General Public License for more details. 016 * 017 * You should have received a copy of the GNU General Public License 018 * along with jcoverage; if not, write to the Free Software 019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 020 * USA 021 * 022 */ 023 package com.jcoverage.coverage; 024 025 /** 026 * A conditional records the position of a conditional branch 027 * instruction, and the position of the branch target. Conditionals 028 * are used internally by the instrumentation to determine branch 029 * coverage. 030 */ 031 class ConditionalImpl implements Conditional,HasBeenInstrumented { 032 int lineNumber; 033 int targetLineNumber; 034 035 ConditionalImpl() { 036 } 037 038 ConditionalImpl(int lineNumber,int targetLineNumber) { 039 this.lineNumber=lineNumber; 040 this.targetLineNumber=targetLineNumber; 041 } 042 043 public int getLineNumber() { 044 return lineNumber; 045 } 046 047 public int getTargetLineNumber() { 048 return targetLineNumber; 049 } 050 051 public String toString() { 052 StringBuffer sb=new StringBuffer(); 053 sb.append('['); 054 sb.append("line: "); 055 sb.append(getLineNumber()); 056 sb.append(", target: "); 057 sb.append(getTargetLineNumber()); 058 sb.append(']'); 059 return sb.toString(); 060 } 061 }