Clover coverage report - Replica - 1.0-Alpha
Coverage timestamp: Dom Fev 1 2004 17:00:58 WET
file stats: LOC: 113   Methods: 9
NCLOC: 75   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
MSQLNames.java 0% 0% 0% 0%
coverage
 1   
 package mobisnap.mobile_trx;
 2   
 
 3   
 import java.util.*;
 4   
 
 5   
 public class MSQLNames
 6   
 {
 7   
     Vector names;
 8   
     
 9  0
     public MSQLNames() {
 10  0
         names = new Vector();
 11   
         
 12  0
         inScope();
 13  0
         try {
 14  0
             newFunction( "notify", new MSQLTFunNotify());
 15  0
             newFunction( "print", new MSQLTFunPrint());
 16   
         } catch( Exception e) {
 17   
             // do nothing
 18   
         }
 19   
     }
 20   
     
 21   
     /**
 22   
      * Reset names
 23   
      */
 24  0
     public void reset() {
 25  0
         names.removeAllElements();
 26   
         
 27  0
         inScope();
 28  0
         try {
 29  0
             newFunction( "notify", new MSQLTFunNotify());
 30  0
             newFunction( "print", new MSQLTFunPrint());
 31   
         } catch( Exception e) {
 32   
             // do nothing
 33   
         }
 34   
     }
 35   
     
 36   
     /**
 37   
      * The code execution has entered a new scope
 38   
      */
 39  0
     public void inScope() {
 40  0
         names.addElement( new Hashtable());
 41   
     }
 42   
     
 43   
     /**
 44   
      * The code execution has exited a new scope - all names declared in this
 45   
      * scope should be removed
 46   
      */
 47  0
     public void outScope() {
 48  0
         if( names.size() > 0)
 49  0
             names.removeElementAt( names.size() - 1);
 50   
     }
 51   
     
 52   
     /**
 53   
      * Returns the variable that represents the given name
 54   
      */
 55  0
     public MSQLTName getName( String name)
 56   
             throws Exception {
 57  0
         for( int i = names.size() - 1 ; i >= 0 ; i--) {
 58  0
             Hashtable table = (Hashtable)names.elementAt(i);
 59  0
             Object obj = table.get( name);
 60  0
             if( obj != null)
 61  0
                 return (MSQLTName)obj;
 62   
         }
 63  0
         throw new mobisnap.MobisnapException( "Name :" + name + ": not found.");
 64   
     }
 65   
     
 66   
     /**
 67   
      * Returns the function that represents the given name with the given parameters
 68   
      */
 69  0
     public MSQLTName getName( String name, Object[] params)
 70   
             throws Exception {
 71  0
         return getName( name);
 72   
     }
 73   
     
 74   
     /**
 75   
      * Inserts variable
 76   
      */
 77  0
     public void newVariable( String name, MSQLTVariable obj)
 78   
             throws Exception {
 79  0
         if( names.size() == 0)
 80  0
             throw new mobisnap.MobisnapException( "newVariable: new name with no scope defined");
 81  0
         Hashtable table = (Hashtable)names.elementAt( names.size() - 1);
 82  0
         if( table.get( name) != null)
 83  0
             throw new mobisnap.MobisnapException( "newVariable: name already exists");
 84  0
         table.put( name, obj);
 85   
     }
 86   
     
 87   
     /**
 88   
      * Inserts function
 89   
      */
 90  0
     public void newFunction( String name, MSQLTFunction obj)
 91   
             throws Exception {
 92  0
         if( names.size() == 0)
 93  0
             throw new mobisnap.MobisnapException( "newFunction: new name with no scope defined");
 94  0
         Hashtable table = (Hashtable)names.elementAt( names.size() - 1);
 95  0
         if( table.get( name) != null)
 96  0
             throw new mobisnap.MobisnapException( "newFunction: name already exists");
 97  0
         table.put( name, obj);
 98   
     }
 99   
     
 100  0
     public void dump() {
 101  0
         Enumeration enum = names.elements();
 102  0
         while( enum.hasMoreElements()) {
 103  0
             Hashtable table = (Hashtable)enum.nextElement();
 104  0
             Enumeration enum2 = table.keys();
 105  0
             while( enum2.hasMoreElements()) {
 106  0
                 String s = (String)enum2.nextElement();
 107  0
                 MSQLTName var = (MSQLTName)table.get( s);
 108  0
                 System.out.println( s + "---->" + var);
 109   
             }
 110   
         }
 111   
     }
 112   
 }
 113