Clover coverage report - XJavaDoc - 1.1
Coverage timestamp: Mon Oct 4 2004 23:49:51 BST
file stats: LOC: 127   Methods: 9
NCLOC: 74   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ParameterImpl.java 0% 38.5% 66.7% 37.2%
coverage coverage
 1   
 /*
 2   
  * Copyright (c) 2001-2003 The XDoclet team
 3   
  * All rights reserved.
 4   
  */
 5   
 package xjavadoc;
 6   
 
 7   
 import java.util.Iterator;
 8   
 import java.util.StringTokenizer;
 9   
 
 10   
 /**
 11   
  * This is a flyweight implementation of XParameter
 12   
  *
 13   
  * @author    Ara Abrahamian (ara_e_w@yahoo.com)
 14   
  * @author    Aslak Hellesøy
 15   
  * @created   9. mars 2003
 16   
  * @version   $Revision: 1.18 $
 17   
  */
 18   
 public final class ParameterImpl extends AbstractType implements XParameter
 19   
 {
 20   
     public static int  instanceCount = 0;
 21   
 
 22   
     /**
 23   
      * XMember we're currently reresenting.
 24   
      */
 25   
     private AbstractExecutableMember _containingExecutableMember;
 26   
 
 27   
     /**
 28   
      * Index of the parameter we're currently representing.
 29   
      */
 30   
     private int        _parameterIndex;
 31   
 
 32   
     private String     _description;
 33   
 
 34  180
     public ParameterImpl()
 35   
     {
 36  180
         instanceCount++;
 37   
     }
 38   
 
 39  194
     public final String getName()
 40   
     {
 41  194
         return _containingExecutableMember.getParameterName( _parameterIndex );
 42   
     }
 43   
 
 44   
     /**
 45   
      * Returns the class describing the type of this parameter.
 46   
      *
 47   
      * @return
 48   
      */
 49  942
     public final XClass getType()
 50   
     {
 51  942
         String type = _containingExecutableMember.getParameterType( _parameterIndex );
 52  942
         AbstractClass containingClass = _containingExecutableMember.getContainingAbstractClass();
 53   
 
 54  942
         XClass result = containingClass.qualify( type );
 55   
 
 56  942
         return result;
 57   
     }
 58   
 
 59  569
     public final int getDimension()
 60   
     {
 61  569
         return _containingExecutableMember.getParameterDimension( _parameterIndex );
 62   
     }
 63   
 
 64  0
     public XTag getParamTag()
 65   
     {
 66  0
         for( Iterator paramTags = _containingExecutableMember.getDoc().getTags( "param", true ).iterator(); paramTags.hasNext();  )
 67   
         {
 68  0
             XTag paramTag = ( XTag ) paramTags.next();
 69  0
             StringTokenizer st = new StringTokenizer( paramTag.getValue() );
 70   
 
 71  0
             if( st.hasMoreTokens() )
 72   
             {
 73  0
                 if( st.nextToken().equals( getName() ) )
 74   
                 {
 75   
                     // We found the @param tag.
 76   
 
 77   
                     // Set the description so it's readily available if someone asks for it.
 78  0
                     _description = paramTag.getValue().substring( getName().length() ).trim();
 79  0
                     return paramTag;
 80   
                 }
 81   
             }
 82   
         }
 83   
         // Didn't find any param tags.
 84  0
         _description = null;
 85  0
         return null;
 86   
     }
 87   
 
 88  0
     public String getDescription()
 89   
     {
 90  0
         XTag paramTag = getParamTag();
 91   
 
 92  0
         if( paramTag != null )
 93   
         {
 94  0
             return _description;
 95   
         }
 96   
         else
 97   
         {
 98  0
             return null;
 99   
         }
 100   
     }
 101   
 
 102  194
     public String getDimensionAsString()
 103   
     {
 104  194
         return Util.appendDimensionAsString( getDimension(), new StringBuffer() ).toString();
 105   
     }
 106   
 
 107  0
     public final String toString()
 108   
     {
 109  0
         StringBuffer sb = new StringBuffer( getType().getQualifiedName() );
 110   
 
 111  0
         Util.appendDimensionAsString( getDimension(), sb ).append( " " ).append( getName() );
 112  0
         return sb.toString();
 113   
     }
 114   
 
 115   
     /**
 116   
      * Sets the extrinsic flyweight state.
 117   
      *
 118   
      * @param containingExecutableMember  The containing member
 119   
      * @param parameterIndex
 120   
      */
 121  955
     final void setState( AbstractExecutableMember containingExecutableMember, int parameterIndex )
 122   
     {
 123  955
         _containingExecutableMember = containingExecutableMember;
 124  955
         _parameterIndex = parameterIndex;
 125   
     }
 126   
 }
 127