EMMA Coverage Report (generated Wed Jun 28 19:54:35 CEST 2006)
[all classes][smallsql.database]

COVERAGE SUMMARY FOR SOURCE FILE [Expressions.java]

nameclass, %method, %block, %line, %
Expressions.java100% (1/1)87%  (13/15)76%  (202/265)78%  (40,8/52)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Expressions100% (1/1)87%  (13/15)76%  (202/265)78%  (40,8/52)
Expressions (int): void 0%   (0/1)0%   (0/7)0%   (0/3)
toArray (Expression []): void 0%   (0/1)0%   (0/9)0%   (0/2)
get (int): Expression 100% (1/1)36%  (9/25)67%  (2/3)
indexOf (Expression): int 100% (1/1)57%  (21/37)62%  (5/8)
addAll (Expressions): void 100% (1/1)82%  (27/33)83%  (5/6)
add (int, Expression): void 100% (1/1)83%  (30/36)80%  (4/5)
setSize (int): void 100% (1/1)88%  (23/26)94%  (3,8/4)
Expressions (): void 100% (1/1)100% (7/7)100% (3/3)
add (Expression): void 100% (1/1)100% (24/24)100% (4/4)
clear (): void 100% (1/1)100% (4/4)100% (2/2)
remove (int): void 100% (1/1)100% (19/19)100% (2/2)
resize (int): void 100% (1/1)100% (15/15)100% (4/4)
set (int, Expression): void 100% (1/1)100% (6/6)100% (2/2)
size (): int 100% (1/1)100% (3/3)100% (1/1)
toArray (): Expression [] 100% (1/1)100% (14/14)100% (3/3)

1/* =============================================================
2 * SmallSQL : a free Java DBMS library for the Java(tm) platform
3 * =============================================================
4 *
5 * (C) Copyright 2004-2006, by Volker Berlin.
6 *
7 * Project Info:  http://www.smallsql.de/
8 *
9 * This library is free software; you can redistribute it and/or modify it 
10 * under the terms of the GNU Lesser General Public License as published by 
11 * the Free Software Foundation; either version 2.1 of the License, or 
12 * (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful, but 
15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
17 * License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
22 * USA.  
23 *
24 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
25 * in the United States and other countries.]
26 *
27 * ---------------
28 * Expressions.java
29 * ---------------
30 * Author: Volker Berlin
31 * 
32 */
33package smallsql.database;
34 
35/**
36 * @author Volker Berlin
37 *
38 */
39final class Expressions {
40        private int size;
41        private Expression[] data;
42        
43        Expressions(){
44                data = new Expression[16];
45        }
46        
47        Expressions(int initSize){
48                data = new Expression[initSize];
49        }
50        
51        
52        final int size(){
53                return size;
54        }
55        
56 
57        final void setSize(int newSize){
58                for(int i=newSize; i<size; i++) data[i] = null;
59                size = newSize;
60                if(size>data.length) resize(newSize);
61        }
62        
63 
64        final Expression get(int idx){
65                if (idx >= size)
66                        throw new IndexOutOfBoundsException("Index: "+idx+", Size: "+size);
67                return data[idx];
68        }
69        
70        
71        final void add(Expression expr){
72                if(size >= data.length ){
73                        resize(size << 1);
74                }
75                data[size++] = expr;
76        }
77 
78        final void add(int idx, Expression expr){
79                if(size >= data.length ){
80                        resize(size << 1);
81                }
82                System.arraycopy( data, idx, data, idx+1, (size++)-idx);
83                data[idx] = expr;
84        }
85        
86        final void addAll(Expressions cols){
87                int count = cols.size();
88                if(size + count >= data.length ){
89                        resize(size + count);
90                }
91                System.arraycopy( cols.data, 0, data, size, count);
92                size += count;
93        }
94        
95        final void clear(){
96                size = 0;
97        }
98        
99        final void remove(int idx){
100                System.arraycopy( data, idx+1, data, idx, (--size)-idx);
101        }
102 
103        final void set(int idx, Expression expr){
104                data[idx] = expr;
105        }
106 
107        final int indexOf(Expression expr) {
108                if (expr == null) {
109                        for (int i = 0; i < size; i++)
110                                if (data[i]==null)
111                                        return i;
112                } else {
113                        for (int i = 0; i < size; i++)
114                                if (expr.equals(data[i]))
115                                        return i;
116                }
117                return -1;
118        }
119        
120        final void toArray(Expression[] array){
121                System.arraycopy( data, 0, array, 0, size);
122        }
123        
124        final Expression[] toArray(){
125                Expression[] array = new Expression[size];
126                System.arraycopy( data, 0, array, 0, size);
127                return array;
128        }
129        
130        private final void resize(int newSize){
131                Expression[] dataNew = new Expression[newSize];
132                System.arraycopy(data, 0, dataNew, 0, size);
133                data = dataNew;                
134        }
135}

[all classes][smallsql.database]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov