001/* 002 * Cobertura - http://cobertura.sourceforge.net/ 003 * 004 * Copyright (C) 2011 Piotr Tabor 005 * 006 * Note: This file is dual licensed under the GPL and the Apache 007 * Source License (so that it can be used from both the main 008 * Cobertura classes and the ant tasks). 009 * 010 * Cobertura is free software; you can redistribute it and/or modify 011 * it under the terms of the GNU General Public License as published 012 * by the Free Software Foundation; either version 2 of the License, 013 * or (at your option) any later version. 014 * 015 * Cobertura is distributed in the hope that it will be useful, but 016 * WITHOUT ANY WARRANTY; without even the implied warranty of 017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 018 * General Public License for more details. 019 * 020 * You should have received a copy of the GNU General Public License 021 * along with Cobertura; if not, write to the Free Software 022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 023 * USA 024 */ 025 026package net.sourceforge.cobertura.instrument.tp; 027 028import java.util.concurrent.atomic.AtomicInteger; 029 030/** 031 * Root class for all touch-points (points in source-code that we want to monitor) 032 * 033 * @author piotr.tabor@gmail.com 034 * 035 */ 036public abstract class TouchPointDescriptor { 037 038 public TouchPointDescriptor(int eventId, int lineNumber) { 039 this.eventId = eventId; 040 this.lineNumber = lineNumber; 041 } 042 043 /** 044 * eventId (asm code identifier) of the interesting instruction 045 */ 046 private int eventId; 047 048 /** 049 * Number of line in which the touch-point is localized 050 */ 051 private int lineNumber; 052 053 /** 054 * @return eventId (asm code identifier) of the interesting instruction 055 */ 056 public int getEventId() { 057 return eventId; 058 } 059 /** 060 * Sets eventId (asm code identifier) of the interesting instruction 061 */ 062 063 public void setEventId(int eventId) { 064 this.eventId = eventId; 065 } 066 067 /** 068 * @return number of line in which the touch-point is localized 069 */ 070 public int getLineNumber() { 071 return lineNumber; 072 } 073 074 /** 075 * Sets number of line in which the touch-point is localized 076 */ 077 public void setLineNumber(int lineNumber) { 078 this.lineNumber = lineNumber; 079 } 080 081 /** 082 * Every touch-point will have assigned some counters. This methods assigne the ids to the touch-point 083 * using given idGenerator 084 085 * @param idGenerator 086 * 087 * @return number of used 'ids' for the touch-point. 088 */ 089 public abstract int assignCounters(AtomicInteger idGenerator); 090}