KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mountainminds > eclemma > internal > ui > annotation > CoverageAnnotation


1 /*******************************************************************************
2  * Copyright (c) 2006 Mountainminds GmbH & Co. KG
3  * This software is provided under the terms of the Eclipse Public License v1.0
4  * See http://www.eclipse.org/legal/epl-v10.html.
5  *
6  * $Id: CoverageAnnotation.java 12 2006-08-28 20:07:13Z mho $
7  ******************************************************************************/

8 package com.mountainminds.eclemma.internal.ui.annotation;
9
10 import org.eclipse.jface.text.Position;
11 import org.eclipse.jface.text.source.Annotation;
12
13 import com.mountainminds.eclemma.core.analysis.ILineCoverage;
14
15 /**
16  * Annotation object that includes its position information to avoid internal
17  * mappings.
18  *
19  * @author Marc R. Hoffmann
20  * @version $Revision: 12 $
21  */

22 public class CoverageAnnotation extends Annotation {
23   
24   private static final String JavaDoc FULL_COVERAGE = "com.mountainminds.eclemma.ui.fullCoverageAnnotation"; //$NON-NLS-1$
25
private static final String JavaDoc PARTIAL_COVERAGE = "com.mountainminds.eclemma.ui.partialCoverageAnnotation"; //$NON-NLS-1$
26
private static final String JavaDoc NO_COVERAGE = "com.mountainminds.eclemma.ui.noCoverageAnnotation"; //$NON-NLS-1$
27

28   private final Position position;
29   
30   public CoverageAnnotation(int offset, int length, int status) {
31     super(getAnnotationID(status), false, null);
32     position = new Position(offset, length);
33   }
34   
35   public Position getPosition() {
36     return position;
37   }
38   
39   private static String JavaDoc getAnnotationID(int status) {
40     switch (status) {
41       case ILineCoverage.FULLY_COVERED: return FULL_COVERAGE;
42       case ILineCoverage.PARTLY_COVERED: return PARTIAL_COVERAGE;
43       case ILineCoverage.NOT_COVERED: return NO_COVERAGE;
44     }
45     throw new RuntimeException JavaDoc("Invalid status: " + status); //$NON-NLS-1$
46
}
47
48 }
49
Popular Tags