EMMA Coverage Report (generated Sat Nov 03 21:53:04 GMT 2007)
[all classes][sf.qof.parser]

COVERAGE SUMMARY FOR SOURCE FILE [ParameterDefinitionImpl.java]

nameclass, %method, %block, %line, %
ParameterDefinitionImpl.java100% (1/1)100% (19/19)98%  (195/199)98%  (47/48)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ParameterDefinitionImpl100% (1/1)100% (19/19)98%  (195/199)98%  (47/48)
setIndexes (int []): void 100% (1/1)69%  (9/13)75%  (3/4)
ParameterDefinitionImpl (): void 100% (1/1)100% (3/3)100% (1/1)
getField (): String 100% (1/1)100% (3/3)100% (1/1)
getIndexes (): int [] 100% (1/1)100% (3/3)100% (1/1)
getIndexesString (): String 100% (1/1)100% (34/34)100% (8/8)
getNames (): String [] 100% (1/1)100% (3/3)100% (1/1)
getNamesString (): String 100% (1/1)100% (38/38)100% (8/8)
getParameter (): int 100% (1/1)100% (3/3)100% (1/1)
getPartialDefinitionGroup (): String 100% (1/1)100% (3/3)100% (1/1)
getPartialDefinitionPart (): int 100% (1/1)100% (3/3)100% (1/1)
getType (): String 100% (1/1)100% (3/3)100% (1/1)
isPartialDefinition (): boolean 100% (1/1)100% (7/7)100% (1/1)
setField (String): void 100% (1/1)100% (14/14)100% (4/4)
setNames (String []): void 100% (1/1)100% (13/13)100% (4/4)
setParameter (int): void 100% (1/1)100% (4/4)100% (2/2)
setPartialDefinitionGroup (String): void 100% (1/1)100% (4/4)100% (2/2)
setPartialDefinitionPart (int): void 100% (1/1)100% (4/4)100% (2/2)
setType (String): void 100% (1/1)100% (14/14)100% (4/4)
toString (): String 100% (1/1)100% (30/30)100% (1/1)

1/*
2 * Copyright 2007 brunella ltd
3 *
4 * Licensed under the LGPL Version 3 (the "License");
5 * you may not use this file except in compliance with the License.
6 *
7 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
8 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
10 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
11 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
12 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
13 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
14 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
15 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
16 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
17 * THE POSSIBILITY OF SUCH DAMAGE.
18 */
19package sf.qof.parser;
20 
21/**
22 * Default implementation of a parameter definition.
23 */
24public class ParameterDefinitionImpl implements ParameterDefinition {
25 
26  private String[] names;
27  private String field;
28  private int[] indexes;
29  private String type;
30  private int parameter;
31  private String partialDefinitionGroup;
32  private int partialDefinitionPart;
33 
34  public String[] getNames() {
35    return names;
36  }
37 
38  public String getField() {
39    return field;
40  }
41 
42  public int[] getIndexes() {
43    return indexes;
44  }
45 
46  public int getParameter() {
47    return parameter;
48  }
49 
50  public String getType() {
51    return type;
52  }
53 
54  public void setNames(String[] names) {
55    if (names == null || names.length == 0) {
56      this.names = null;
57    } else {
58      this.names = names;
59    }
60  }
61 
62  public void setField(String field) {
63    if (field == null || "".equals(field)) {
64      this.field = null;
65    } else {
66      this.field = field;
67    }
68  }
69 
70  public void setIndexes(int[] indexes) {
71    if (indexes == null || indexes.length == 0) {
72      this.indexes = null;
73    } else {
74      this.indexes = indexes;
75    }
76  }
77 
78  public void setParameter(int parameter) {
79    this.parameter = parameter;
80  }
81 
82  public void setType(String type) {
83    if (type == null || "".equals(type)) {
84      this.type = "auto";
85    } else {
86      this.type = type;
87    }
88  }
89 
90  private String getNamesString() {
91    if (names == null) {
92      return "";
93    }
94    StringBuilder sb = new StringBuilder();
95    for (int i = 0; i < names.length; i++) {
96      if (i > 0) {
97        sb.append(',');
98      }
99      sb.append('"').append(names[i]).append('"');
100    }
101    return sb.toString();
102  }
103 
104  private String getIndexesString() {
105    if (indexes == null) {
106      return "";
107    }
108    StringBuilder sb = new StringBuilder();
109    for (int i = 0; i < indexes.length; i++) {
110      if (i > 0) {
111        sb.append(',');
112      }
113      sb.append(indexes[i]);
114    }
115    return sb.toString();
116  }
117 
118  public String toString() {
119    return "Parameter: " + type + " " + parameter + " (" + getNamesString() + " " + getIndexesString() + ") " + field;
120  }
121 
122  public String getPartialDefinitionGroup() {
123    return partialDefinitionGroup;
124  }
125  
126  public void setPartialDefinitionGroup(String partialDefinitionGroup) {
127    this.partialDefinitionGroup = partialDefinitionGroup;
128  }
129 
130  public int getPartialDefinitionPart() {
131    return partialDefinitionPart;
132  }
133  
134  public void setPartialDefinitionPart(int partialDefinitionPart) {
135    this.partialDefinitionPart = partialDefinitionPart;
136  }
137 
138  public boolean isPartialDefinition() {
139    return partialDefinitionPart > 0;
140  }
141}

[all classes][sf.qof.parser]
EMMA 2.0.5312 (C) Vladimir Roubtsov