Clover coverage report - Replica - 1.0-Alpha
Coverage timestamp: Dom Fev 1 2004 17:00:58 WET
file stats: LOC: 234   Methods: 23
NCLOC: 141   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
SimpleNode.java 0% 0% 0% 0%
coverage
 1   
 /* Generated By:JJTree:    Do not edit    this line. SimpleNode.java */
 2   
 
 3   
 package    mobisnap.mobile_trx;
 4   
 
 5   
 public class SimpleNode    implements Node    {
 6   
     protected Node parent;
 7   
     protected Node[] children;
 8   
     protected int id;
 9   
     protected MobisnapSQL parser;
 10   
 
 11  0
     public SimpleNode(int i) {
 12  0
         id = i;
 13   
     }
 14   
 
 15  0
     public SimpleNode(MobisnapSQL p, int i)    {
 16  0
         this(i);
 17  0
         parser = p;
 18   
     }
 19   
 
 20  0
     public void    jjtOpen() {
 21   
     }
 22   
 
 23  0
     public void    jjtClose() {
 24   
     }
 25   
     
 26  0
     public void    jjtSetParent(Node n) { parent =    n; }
 27  0
     public Node    jjtGetParent() { return    parent;    }
 28   
 
 29  0
     public void    jjtAddChild(Node n,    int    i) {
 30  0
         if (children ==    null) {
 31  0
             children = new Node[i +    1];
 32  0
         } else if (i >=    children.length) {
 33  0
             Node c[] = new Node[i +    1];
 34  0
             System.arraycopy(children, 0, c, 0,    children.length);
 35  0
             children = c;
 36   
         }
 37  0
         children[i]    = n;
 38   
     }
 39   
 
 40  0
     public Node    jjtGetChild(int    i) {
 41  0
         return children[i];
 42   
     }
 43   
 
 44  0
     public int jjtGetNumChildren() {
 45  0
         return (children ==    null) ?    0 :    children.length;
 46   
     }
 47   
 
 48   
     /**    Accept the visitor.    **/
 49  0
     public Object jjtAccept(MobisnapSQLVisitor visitor, Object data) {
 50  0
         return visitor.visit( this, data);
 51   
     }
 52   
 
 53   
     /**    Accept the visitor.    **/
 54  0
     public Object childrenAccept( MobisnapSQLVisitor visitor, Object data)    {
 55  0
         if (children !=    null) {
 56  0
             for    (int i = 0;    i    < children.length; ++i)    {
 57  0
                 children[i].jjtAccept(visitor, data);
 58   
             }
 59   
         }
 60  0
         return data;
 61   
     }
 62   
 
 63   
     /* You can override    these two methods in subclasses    of SimpleNode to
 64   
     customize the way the node appears when    the    tree is    dumped.     If
 65   
     your output    uses more than one line    you    should override
 66   
     toString(String), otherwise    overriding toString() is probably all
 67   
     you    need to    do.    */
 68   
 
 69   
 //    public String toString() { return MobisnapSQLTreeConstants.jjtNodeName[id];    }
 70  0
     public String toString(String prefix) {    return prefix +    toString();    }
 71  0
     public String toString() {
 72  0
         return toString( mobisnap.MobisnapConstants.MSQL_SERVER);
 73   
     }
 74   
     
 75  0
     public String toString( int msql_type) {
 76  0
         try {
 77  0
             StringBuffer buf = new StringBuffer();
 78  0
             sourceCode( msql_type, buf);
 79  0
             return buf.toString();
 80   
         } catch( Exception e) {
 81  0
             e.printStackTrace();
 82  0
             return "Exception";
 83   
         }
 84   
     }
 85   
 
 86   
     /* Override    this method    if you want    to customize how the node dumps
 87   
     out    its    children. */
 88   
 
 89  0
     public void    dump(String    prefix)    {
 90  0
         System.out.println(toString(prefix));
 91  0
         if (children !=    null) {
 92  0
             for    (int i = 0;    i <    children.length; ++i) {
 93  0
                 SimpleNode n = (SimpleNode)children[i];
 94  0
                 if (n != null) {
 95  0
                     n.dump(prefix +    " ");
 96   
                 }
 97   
             }
 98   
         }
 99   
     }
 100   
 
 101   
 
 102   
     // Manually    inserted code begins here
 103   
 
 104   
     //    public Token firstToken, lastToken;
 105   
     
 106   
     /**
 107   
      * Process the given node, interpreting the source code
 108   
      * 
 109   
      * @param msql_type Specifies which type of processing should be performed
 110   
      *        MobisnapConstants.MSQL_SERVER = 1
 111   
      *        MobisnapConstants.MSQL_TENTATIVE_CLIENT = 2
 112   
      *        MobisnapConstants.MSQL_STABLE_CLIENT = 3
 113   
      */
 114  0
     public void process( int msql_type) throws Exception {
 115  0
         if(    children !=    null)
 116  0
             for( int i = 0;    i <    children.length; i++)
 117  0
                 if(    children[i]    instanceof SimpleNode)
 118  0
                     ((SimpleNode)children[i]).process( msql_type);
 119   
     }
 120   
     
 121   
     /**
 122   
      * Returns the value of the expression
 123   
      * 
 124   
      * @param msql_type Specifies which type of processing should be performed
 125   
      *        MobisnapConstants.MSQL_SERVER = 1
 126   
      *        MobisnapConstants.MSQL_TENTATIVE_CLIENT = 2
 127   
      *        MobisnapConstants.MSQL_STABLE_CLIENT = 3
 128   
      *        MobisnapConstants.MSQL_RESERVATION_CLIENT = 4
 129   
      * @param cond True if reservations associated iwth transaction should be 
 130   
      * propagated to the current transaction
 131   
      */
 132  0
     public Object value( int msql_type, boolean cond) throws Exception {
 133  0
         return new mobisnap.MobisnapException( "Node has no value");
 134   
     }
 135   
     
 136   
     /**
 137   
      * Returns a simplified node, if possible (usefull in expressions)
 138   
      * 
 139   
      * @param msql_type Specifies which type of processing should be performed
 140   
      *        MobisnapConstants.MSQL_SERVER = 1
 141   
      *        MobisnapConstants.MSQL_TENTATIVE_CLIENT = 2
 142   
      *        MobisnapConstants.MSQL_STABLE_CLIENT = 3
 143   
      *        MobisnapConstants.MSQL_RESERVATION_CLIENT = 4
 144   
      * @param cond True if reservations associated iwth transaction should be 
 145   
      * propagated to the current transaction
 146   
      */
 147  0
     public SimpleNode simplify( int msql_type, boolean cond) {
 148  0
         return this;
 149   
     }
 150   
     
 151   
 
 152   
     // Code    used to    rebuild    the    source code
 153   
 
 154   
     public Token firstToken, lastToken;
 155   
 
 156   
     /**
 157   
      * Displays the source code of the node
 158   
      * 
 159   
      * @param msql_type Specifies which type of processing should be performed
 160   
      *        MobisnapConstants.MSQL_SERVER = 1
 161   
      *        MobisnapConstants.MSQL_TENTATIVE_CLIENT = 2
 162   
      *        MobisnapConstants.MSQL_STABLE_CLIENT = 3
 163   
      */
 164  0
     public void    sourceCode(    int msql_type, StringBuffer buffer) throws Exception {
 165  0
         Token t    = firstToken;
 166  0
         boolean    allPrinted = false;
 167  0
         for    ( int i    = 0; i < jjtGetNumChildren(); i++) {
 168  0
             SimpleNodeAux sna =    sourceNode0( i,    t, msql_type, buffer);
 169  0
             t =    sna.nextToken;
 170  0
             allPrinted = sna.allPrinted;
 171   
         }
 172  0
         while (    ! allPrinted &&    t != null) {
 173  0
             if(    t == lastToken)
 174  0
                 allPrinted = true;
 175  0
             sourceCode(    t, msql_type, buffer);
 176  0
             t =    t.next;
 177   
         }
 178   
     }
 179   
     
 180   
     // The following method    prints token t,    as well    as all preceding 
 181   
     // special tokens (essentially,    white space    and    comments).
 182   
 
 183  0
     public void    sourceCodeSpecial(Token    t, int msql_type, StringBuffer    buffer)    {
 184  0
         Token tt = t.specialToken;
 185  0
         if (tt != null)    {
 186  0
             while (tt.specialToken != null)    tt = tt.specialToken;
 187  0
             while (tt != null) {
 188  0
                 if( buffer != null)
 189  0
                     buffer.append(addUnicodeEscapes(tt.image));
 190  0
                 tt = tt.next;
 191   
             }
 192   
         }
 193   
     }
 194   
 
 195  0
     public void    sourceCode(    Token t, int msql_type, StringBuffer buffer) {
 196  0
         sourceCodeSpecial( t, msql_type, buffer);
 197  0
         if( buffer != null)
 198  0
             buffer.append( addUnicodeEscapes(t.image));
 199   
     }
 200   
 
 201   
 
 202   
     /**
 203   
      * NOTE: Returns the next token    to be printed
 204   
      */
 205  0
     public SimpleNodeAux sourceNode0( int pos, Token t, int msql_type, StringBuffer buffer) throws Exception {
 206  0
         SimpleNode node    = (SimpleNode)jjtGetChild(pos);
 207  0
         if(    pos    + 1    < jjtGetNumChildren() && ((SimpleNode)jjtGetChild( pos + 1)).firstToken    == firstToken)
 208  0
             return new SimpleNodeAux( t, false);
 209  0
         while(    t != null && t != node.firstToken) {
 210  0
             sourceCode(    t, msql_type, buffer);
 211  0
             t =    t.next;
 212   
         }
 213  0
         node.sourceCode( msql_type, buffer);
 214  0
         return new SimpleNodeAux( node.lastToken.next, node.lastToken == lastToken);
 215   
     }
 216   
     
 217  0
     public String addUnicodeEscapes(String str)    {
 218  0
         String retval =    "";
 219  0
         char ch;
 220  0
         for    (int i = 0;    i <    str.length(); i++) {
 221  0
             ch = str.charAt(i);
 222  0
             if ((ch    < 0x20 || ch > 0x7e) &&    ch != '\t' && ch !=    '\n' &&    ch != '\r' && ch !=    '\f') {
 223  0
                 String s = "0000" +    Integer.toString(ch, 16);
 224  0
                 retval += "\\u"    + s.substring(s.length() - 4, s.length());
 225   
             } else {
 226  0
                 retval += ch;
 227   
             }
 228   
         }
 229  0
         return retval;
 230   
     }
 231   
     
 232   
 }
 233   
 
 234